Just two years after Sony Pictures got slimed with $719 million in losses thanks to misfires like “Ghostbusters,” the studio has recovered with a banner $1.2 billion year at the domestic box office.

Due to the end-of-2017 hit “Jumanji: Welcome to the Jungle” and the Spider-Man spinoff “Venom,” the studio leapfrogged ahead of 20th Century Fox in market share to 10.7 percent, its biggest slice of the North American box office since 2014.

That’s the best performance under chairman Tom Rothman since he took over in 2015 and among the studio’s best annual results since 2012, when it had a trifecta of franchise hits with the James Bond entry “Skyfall,” “The Amazing Spider-Man” and “MiB 3.”

Also Read: Despite 'Deadpool 2,' Disney-Bound 20th Century Fox Exits Without a Roar

“Sony has a knack for aligning with the right stars and picking the perfect franchises to draw huge crowds, and they hit the jackpot with this strategy in 2018,” comScore analyst Paul Dergarabedian said.

He points to last December’s “Jumanji” reboot as an example of Sony’s resurgent franchise-building, as the Dwayne Johnson blockbuster earned more than half its $404 million domestic gross in 2018 after pushing the studio’s 2017 domestic total past the $1 billion mark in the final week of the year.

The studio then continued to find success with the family films “Peter Rabbit,” which earned $115 million domestically on a $50 million budget, and “Hotel Transylvania 3,” an $80 million animated sequel whose $527 million worldwide take defied the franchise odds by topping its predecessor by $50 million.

Also Read: Despite 'Deadpool 2,' Disney-Bound 20th Century Fox Exits Without a Roar

Sony also had modest success with two summer action sequels, the Denzel Washington-led “Equalizer 2,” which grossed $190 million globally on a $62 million budget, and “Sicario: Day of the Soldado,” a $35 million film that grossed $75 million worldwide.

“Sony’s been looking for franchises to keep up with the other top studios, and now they have them,” Exhibitor Relations analyst Jeff Bock said earlier this month.

The studio also gambled on extensions of its lone Marvel Comics franchise, Spider-Man. Tom Hardy’s “Venom,” the first in a planned series of Spidey spinoffs unconnected to Marvel Studios, overcame bad reviews (and a 29 percent Rotten Tomatoes score) to become the fifth-highest grossing film of 2018 worldwide, with $854 million earned. That includes $212 million in the North America and a studio-record $270 million in China.

Also Read: 2018 Box Office Sets Domestic Annual Record With Over $11.38 Billion

Then came the studio’s next Spidey spin-off, “Spider-Man: Into the Spider-Verse,” a $90 million animated film centering on a post-Peter Parker version of the webslinger. It opened to a strong $35 million, and a sequel has already been announced.

Just two weeks before the “Venom” opening, the Japan-based conglomerate showed confidence in Rothman’s leadership by extending his contract as head of the Motion Picture Group. And in January, Steve Bersch replaced longtime exec Clint Culpepper as head of the studio’s low-budget genre division Screen Gems.

Rothman has taken some lumps too. “The Girl in the Spider’s Web,” a $43 million attempt to revitalize the “Dragon Tattoo” series with Claire Foy as goth hacker Lisbeth Salander, took in an abysmal $34 million worldwide.

Also Read: Inside Disney's 'Insane' Multibillion-Dollar Year: Fox, Killer Box Office and 'Black Panther'

And the studio stumbled trying to turn Hugh Jackman’s “The Front Runner” into a limited-release awards contender; the film topped out at $2 million domestically.

But Bock pointed to the 2019 slate for signs that Sony’s winning streak might continue. “Next year they’ll have more Spider-Man and another ‘Jumanji,’ and they’ll be banking on audiences coming back for more of those,” Bock said.