I agree that it would be better form to directly mention an antecedent for "it" (e.g., a good grade, as Barb mentioned).
However, "it" refers elliptically to the good grade, so I think the sentence does work. It might be viewed as a bit lazy though, so if this is writing that you yourself will be judged or graded on, I would name the antecedent as others have mentioned.
In informal speech, I wouldn't have even thought twice about the meaning because the reference is obvious. I would even venture to say that this is a common way to say this where I'm from. If the sentence in the OP were used in informal speech, the speaker probably wouldn't take the time to say "Getting a good grade on that test was very difficult, but I pulled it off."
Perhaps it's unusual in some regions, but not where I'm from (again if you are being judged on your writing, then of course it's probably better to establish the antecedent). If you are writing informal fiction, depending on what region your speakers are from and the setting of the story, the sentence in the OP might sound quite natural.