I think Ned didn’t break Doctor Strange’s spell, he just did basic math. He spent four years obsessing over Spider-Man, heard MJ accidentally drop the name "Peter," and then had a guy walk up to him, do their high school handshake, and say his name is Peter. That look on Ned's face at the end isn't "I remember high school," it's "holy crap, my new friend is Spider-Man.
Overrated spidey movie. They squared the time line. Having Jean Grey in the same universe as spider man means theres the xmen in the same universe as the avengers??? which we know isnt true. Idk am I missing something??