“The Martian” rocketed to $50.1 million in China this weekend, demonstrating that it pays to have the world’s second-largest film market play a key role in a picture’s plot.

In the film, China’s space program gives critical aid to NASA that allows the governmental organization to bring a stranded astronaut (Matt Damon) back to earth. Other films, such as “Transformers: Age of Extinction,” have shot in China or included Chinese actors — a series of nods to the People’s Republic that historically has paid off at ticket booths.

“If you include China in your film it goes a long way at the box office,” said Jeff Bock, an analyst with Exhibitor Relations. “People say that jingoism goes a long way in America. Well, it does in other countries too and we’ll probably see more of it going forward.”

Fox released the science-fiction adventure, which has gone on to make $545.1 million globally. It easily ranks as the highest-grossing film of director Ridley Scott’s career, passing the $457.6 million made by “Gladiator.” It’s also the best performing film to star Damon, pushing ahead of “The Bourne Ultimatum” ($442.8 million).

“The Martian’s” opening topped Chinese charts, and outranks previous outer-space themed films like “Gravity” and “Interstellar,” positioning it well for the future. Japan will be the final market where it opens when it debuts in February, 2016.

Despite the massive results, “The Martian” wasn’t the highest-grossing film at the foreign box office. That honor went to “The Hunger Games: Mockingjay – Part 2” with $62 million. The final film in the futuristic franchise has made $440.7 million in global ticket sales.