I was taught at school that the following expression is not grammatically correct:
Who is there? It's me.
The correct one is:
Who is there? It's I.
Can you let me know which one is accurate?
As reported from the NOAD:
pronoun [first person singular]
1. used by a speaker to refer to himself or herself as the object of a verb or preposition:
Do you understand me?
Wait for me!
• used after the verb to be and after than or as:
Hi, it's me.
You have more than me.
• informal to or for myself:
I've got me a job.
It's then correct to say it's me.
"It is ME" is not grammatically correct in the academic sense, but is used in spoken English.
"It is I" is grammatically correct in the pure sense, but would never be used in spoken English - or very rarely by people who speak in an ultra-formal dialect.
"It is I" would have been correct in Shakespeare's time, in spoken English, but not now.
This question is related to I can run faster than... In that exchange nohat describes the pronouns being used in the nominative and accusative cases. Modern English speakers have become more comfortable using the accusative case in comparisons even though traditionally comparisons have used the nominative case. It is further noted that "both forms are standard."
Modern English has slurred the distinction between cases, using word order to denote case rather than declension. We still use different words for most personal pronouns (he/him, I/me, we/us), but have lost it for you/you. "I talk to you." "You talk to me."
When asking "Who is there?" it would be correct to answer in the nominative case, "I am here." Likewise, asking "Who is it?" should elicit "It is I" or "I am it."
It varies on context.
Who called Jodie? It was he.
Who told you about it? It was I.
Who had the phone conversation? It must have been they.
Who cares? It is we.
An aside: when you knock at a door, and someone from inside asks "Who's there?", Don't answer "Me" or "It's me". Aside from being ungrammatical, it conveys no information (unless the other person knows your voice).
We need to make the distinction between written and spoken English, especially informal spoken English - as between friends. Almost everyone says things like "Me and my brother went to the beach", but you certainly wouldn't say that giving a speech in a public forum.
Here's a good exlanation of the "it's me/I" construction:
"The traditional grammar rule states when a pronoun follows a linking verb, such as "is," the pronoun should be in the subject case. It’s also called the “nominative.”