Peter Parker "died," then came back to life.
A voice calling itself the "Overseer" offers him a deal: become a superhero in other universes, and once he completes his missions, everyone he lost, Uncle Ben, Aunt May, Tony, will come back to life. The price is that he must stay forever, and no one in that world will remember him.
So, wearing his red-and-blue suit, he is thrown into Gotham, a city of crime.
There is a black-clad Batman who never kills, a group of vigilantes who bring children out onto the streets, and an entire city waiting for him to save them, and to prove himself. At first, he only wants to finish his mission and bring back the people he longs to see.
But after swinging through Gotham's rainy night, being caught securely from behind by the Bat, and having a locksmith quietly hand him warm bread, he suddenly can't tell anymore
Did he come here to be a hero, or... to come home?
The writing is excellent; I highly recommend it.
I thought it was Spider-Man 4, but it turns out it's the ending of Spider-Man 3.