The currently accepted answer is correct. However, the specific mechanism by which Peter's identity was erased from the world's memory (and from recorded history, since he revealed his identity on camera) was revealed in the "One Moment in Time" storyline, in Amazing Spider-Man #638-641.
That mechanism was through a variation of what Dr. Strange and Reed Richards had done to (temporarily, as it turned out) remove the Sentry from the world's memory (including the memory of the Sentry himself). They added Tony Stark to the mix, because Extremis would allow him to better control the process, reducing the risk involved:

Since Reed, Stephen and Tony agreed that only Peter should remember the truth, not even they know the full details. And, it doesn't appear that Stephen went over the details with Peter, so he doesn't necessarily know, either:

Because he can't imagine life without MJ, or keeping this from her, he pulls her into the "glob of remembrance" as well.
We know from previous stories that anyone he chose to remind of his identity would remember everything they'd forgotten. We also know he revealed his ID to the FF and the Avengers (at a minimum) after this.