A game based on the 2004 film "Spider-Man 2" was released in 2004 for most of the major gaming platforms of the time. It was developed by Vicarious Visions and published by Activision.
"Spider-Man 2" was ported to all of the major consoles and handhelds of the time, but did not get a PC release.
"The Amazing Spider-Man 2," based on the film of the same name, was also published by Activision and released in 2014. It was released for all of the major consoles, as well as the PC, iOS and Nintendo 3DS.
There have been a number of other games that have used "Spider-Man 2" somewhere in the title over the years, but they are not based on either of the films.