Peter Parker is returning to Marvel. (Or will it be Miles Morales?)

In a reboot of the “Spider-Man” franchise, Sony Pictures Entertainment has announced a new partnership with Marvel Studios that brings the popular superhero into the Marvel universe.

A new Spider-Man film will hit theaters on July 28, 2017.

Sony has owned the feature rights to comic book character since 1999, when Marvel sold them for $7 million.

According to the deal, Sony and Marvel will cast a new Spidey after Andrew Garfield starred in the last two films, “The Amazing Spider-Man” and “The Amazing Spider-Man 2.” Tobey Maguire played Peter Parker in the previous three installments for Sony.

Marvel’s Kevin Feige will produce the rebooted Spider-Man with Amy Pascal, who recently stepped down as co-chairman of Sony in a new producer deal. She oversaw the $4 billion Spider-Man franchise for over 13 years at the studio.

Sony will continue to distribute, finance, own and have final creative control of the Spider-Man pics.

They’ll work with Marvel, owned by Disney, to weave Spider-Man’s character into Marvel’s upcoming superhero films, which includes the popular franchise “The Avengers.”

As Variety previously reported, Marvel plans on bringing the Civil War storyline from the comic books to launch the next phase of films. It’s very likely that Spider-Man will make his first appearance in “Captain America: Civil War” next year.

To make room for Spider-Man, Disney has rescheduled a number of Marvel tentpoles, including “Thor: Ragnorak,” which was originally planned to open on the July 28, 2017 date. It moves to Nov. 3, 2017. “Black Panther,” which had the Nov. 3 date, will now move up to July 6, 2017.

Marvel’s “Inhumans,” meanwhile, has now moved back to summer 2019 while “Captain Marvel” moves back to Nov. 2018.

Bob Iger, Chairman and CEO, The Walt Disney Company said in a statement: “Spider-Man is one of Marvel’s great characters, beloved around the world. We’re thrilled to work with Sony Pictures to bring the iconic web-slinger into the Marvel Cinematic Universe, which opens up fantastic new opportunities for storytelling and franchise building.”

“I am thrilled to team with my friends at Sony Pictures along with Amy Pascal to produce the next Spider-Man movie,” said Marvel Studios President Kevin Feige. “Amy has been deeply involved in the realization on film of one of the world’s most beloved characters. Marvel’s involvement will hopefully deliver the creative continuity and authenticity that fans demand from the MCU.”Sony chairman Michael Lynton added: “This is the right decision for the franchise, for our business, for Marvel, and for the fans.”

Further details of the agreement are unknown.

The deal comes after a turbulent few months for Sony. The Culver City-based studio was recently the victim of a massive cyber-attack by North Korea in what devolved into a financial and publicity nightmare. And just last week, it was announced that Pascal — its veteran exec and face of the studio — would be stepping aside.“I have always wanted to be a producer,” she said at the time. “I have spent almost my entire professional life at Sony Pictures and I am energized to be starting this new chapter based at the company I call home.”