The previous summer's The Amazing Spider-Man 2, the second in the Andrew Garfield films, had grossed $709 million worldwide, down from the first installment's $758 million despite the sequel's higher budget at $265 million. And perhaps most importantly, after more than a decade in the web-slinging business, Sony execs were creatively spent, struggling to find a way to retackle the 900 characters in the Spider-Man comic series covered by the deal it made with Marvel in 1999.

Meanwhile, the 15 films in the MCU, beginning with 2008's Iron Man, have racked up $11.7 billion at the box office. Perlmutter was offering the services of a production company with a red-hot track record to reinvigorate a character that was getting stale — without asking Sony to give up any profits on the film. By reuniting the web-slinging superhero with the rest of the Marvel universe, the company could begin using Spider-Man, its No. 1 character, in non-Sony movies, plus boost merchandise sales. Still, Pascal was skeptical about losing full control of her studio's most important asset.

How the armies of lawyers for the two corporate behemoths, Disney-owned Marvel and Sony, ever reached an agreement in February 2015 might seem complicated. But Marvel Studios president Kevin Feige says it actually was quite simple. "It really came down to me telling Amy in her office that I think the best thing for this character is: Sony has the rights, that's not changing," Feige recalls. "Have Sony pay for the movie, distribute the movie, market the movie. Just let us make the movie and incorporate him into our universe."

As it would happen, Pascal gave a thumbs-up, just as she was ousted in the aftermath of the November 2014 Sony hack. But as part of her exit package, she became a key player in the franchise, transitioning to producing.

Tom Rothman, her studio successor, is now betting on Spider-Man: Homecoming to launch a fresh slate of Spider-Man-themed movies. Hopes are high for hit-starved Sony. That's in part because both Pascal and Feige pushed back on Perlmutter's original budget of $275 million, which would have eclipsed the costs on all four previous Spider-Man films, including the $258 million for Sam Raimi's third outing in 2007. Perhaps more important, Sony wants Homecoming to be embraced by fans, as was the case with Raimi's trilogy. (So far Homecoming is testing very well, scoring in the low 90s. It is tracking to open as high as $100 million).

At $175 million, Homecoming (July 7) marks a smaller gamble than the studio's previous incarnations. Directed by Jon Watts (Cop Car) and starring Tom Holland, 21, Homecoming also follows the blueprint established by Feige: Keep costs down on the first two outings and spend bigger on a third. Homecoming's budget is similar to other MCU stand-alone films like the first two Iron Man and Captain America movies.

When Feige and Pascal began developing the movie, the description given to would-be directors was "a movie as if John Hughes had directed it." According to those who have seen it, Watts has delivered on that mandate. Homecoming is described as one of Marvel's youngest-skewing movies and geared to teens. Even the on-set bonding of the young cast seemed straight out of a Hughes movie: During production in Atlanta, Watts sent the actors out for a picnic in a park and to visit an aquarium.

"Zendaya came up with a really interesting game that brought everyone closer together immediately, where you sit in a circle and you honestly have to tell everyone your first impression of meeting them," recalls Holland.

As for the expansion plans, Tom Hardy is starring in Venom, dated for Oct. 5, 2018, which will also feature the villain Carnage. A source says Holland is only contractually obligated to Spider-Man 2 and 3, but the intention is to bring him into the spinoffs and possibly other Marvel films (he is currently shooting Marvel's Avengers: Infinity War).

"Marvel is so good at [working around your schedule]," Holland told THR. "They're very respectful of your life, really. They understand that you have to work on other movies, and yeah, they try and fix it up so you can work."

Meanwhile, Homecoming villain Michael Keaton has a deal to play the Vulture for just one movie.

Another spinoff, Silver & Black, doesn't have a release date but is eyeing a fall shoot and features characters Silver Sable and Black Cat. Other projects will focus on Kraven the Hunter and Mysterio. The idea, says a studio source, is to build out a world gradually rather than launch one immediately, as they had been trying with Spider-Man villain ensemble Sinister Six, which has been shelved.

Sony will get a to-be-determined Marvel character for Spider-Man 2 like it received for Homecoming with the box-office monster Iron Man, played by Robert Downey Jr. But sources say it won't be Iron Man next time around. Whatever happens in Spider-Man's future, there is palpable excitement on the Sony lot after a string of flops, and at Marvel, which has, for now, some control over its friendly neighborhood Spider-Man.

"Suddenly this goes from being a third reincarnation and a sixth movie to a first," says Feige. "It's the first time Spider-Man gets to interact with the world in which he belongs."

A version of this story first appeared in the June 21 issue of The Hollywood Reporter magazine. To receive the magazine, click here to subscribe.