In the recent trailer for Spider-Man: No Way Home, Peter Parker asks Doctor Strange to restore his secret identity. Impressively enough, it appears that Strange is fully capable of casting this spell on his own. In the comics, however, Doctor Strange needed some serious help Spider-Man restore his secret identity after it became public during Marvel's Civil War. In 2007's Amazing Spider-Man #545 -- by J. Michael Straczynski, Joe Quesada, Danny Miki, Dean White, Richard Isanove and Chris Eliopoulos -- Mephisto restored Peter's secret identity. In doing so, however, Mephisto also altered history so that Peter and Mary Jane were never married, and he would have no memory of this deal.

This altered history was elaborated upon in 2010's Amazing Spider-Man #640-641, by Joe Quesada, Paolo Rivera, Danny Miki, Richard Isanove and VC's Joe Caramagna. In this new version of events, Spider-Man came to Doctor Strange following the events of Civil War, when Peter had revealed his identity to the public before defecting to Captain America's anti-registration forces. In order to keep his family safe, Peter asked Strange to restore his secret identity. Of course, despite what Peter believed, Doctor Strange couldn't restore Spider-Man's secret identity alone. To perform this incredible task, Strange retreated to the astral plane to discuss things with Reed Richards and Tony Stark.

Related: Spider-Man: Kindred Brings One More Super Team Into the Sinister War

Doctor Strange talking to Reed Richards and Iron Man about restoring Spider-Man's secret identity

In the past, Strange and Reed had worked to erase the Sentry from everyone's memories. Considering the danger of that task, Strange asked for Iron Man's help as well. With Tony Stark's assistance, Strange and Reed could accomplish their objective much more thoroughly. Strange also reasoned that both Reed and Tony were at least partially responsible for Peter's current predicament, so they might as well work together to help him.

Tony was hesitant to help, especially after his falling out with Peter during Civil War, but all parties eventually agreed to work together. The three geniuses mixed magic and science in order to wipe the memory of Spider-Man's identity from everyone on the planet, channeling a virus through the Extremis in Tony's system to accomplish their goal.

Tony also made the point that Peter should be the only one to remember his identity and that even the three of them should be made to forget. The process ended up working, wiping the memory of Spider-Man's identity from everyone on the planet except for Peter and Mary Jane. Moreover, no one would be able to deduce Spider-Man's identity unless he was unmasked or told them who he was.

Related: Spider-Man: How Ben Reilly's First Run as Spider-Man Ended

Doctor Strange and Reed Richards explaining how they would restore Spider-Man's secret identity

If Peter revealed his identity to someone, the lost memories would instantly come flooding back to the person in question. In 2009's Amazing Spider-Man #591 (by Dan Slott, Barry Kitson, Dale Eaglesham, Jesse Delperdang, Dean White, Andy Troy, Chris Chuckry and VC's Joe Caramagna,) Peter revealed his identity to the Fantastic Four, who instantly remembered everything about him.

This impressive spell was undone in 2011's Amazing Spider-Man #668, by Slott, Humberto Ramos, Victor Olazaba, Edgar Delgado and VC's Joe Caramagna. During "Spider-Island," Peter stood in front of a camera, using his spider-powers to inspire New Yorkers who had been given spider-powers at the time so they could defend the city.

Unfortunately, this technically exposed Peter's identity, meaning that anyone could figure out that he was Spider-Man from this point forward. Still, most people had forgotten Peter's identity at this point, meaning Spider-Man's secret remained safe. It took a lot of work, but thanks to the assistance of a few very smart friends, Doctor Strange was able to restore Spider-Man's secret identity.

KEEP READING: How Spider-Man Dealt Juggernaut His Most Infamous Defeat