SET IN A fantastical near-future in which America adequately funds its space program, The Martian is the best ad for NASA since Ahmed Mohamed's T-shirt. Just about every frame reinforces a core sentiment: It's time to start caring about space again. The fact that The Martian manages to sell this idea—convincingly and rousingly, with a fair amount of humor—is all the more impressive given that it follows a man who's been marooned 140 million miles away and is forced to spend his days desperately trying to delay his all-but-inevitable death. It's funnier than it sounds.

"Fuck you, Mars," is one of the first things astronaut Mark Watney (Matt Damon) says after realizing he's been left behind by his crewmates—who, in their defense, totally thought he was dead. But Mark isn't dead: He wakes up under a pile of red sand. A metal tube sticks out of his bloody gut. Air rushes out of his suit. So he stumbles to safety, performs a fairly cringe-inducing bit of self-surgery, and realizes his problems have only just begun.

That cringe-y surgery scene has a few things in common with a similar one in Prometheus, director Ridley Scott's last foray into science fiction. But while the rest of Prometheus was rambling gibberish, the rest of The Martian is a tight, funny adventure, given weight by occasionally terrifying developments. The stakes are raised even higher once NASA realizes Watney's still alive—and the same goes for Watney's crewmates, who're rocketing back to Earth while the abandoned astronaut uses his shit to fertilize Martian soil and tries to figure out how to pull water out of the air without blowing himself up. (That takes some trial and error.) Through it all, Watney is surrounded by the kind of stunning imagery only Scott can provide: striking visions of an eerie, gorgeous Mars, its sprawling plains torn by jagged mountains. "I'm the first person to be alone on an entire planet," Watney says. Desolation stretches in every direction.

Damon's fantastic here, but in the 2011 novel by Andy Weir that The Martian is based on, Watney's clever I'm-upbeat-because-if-I'm-not- upbeat-I'll-probably-give-up-and-die-a-horrible-death tone came across even stronger. That's only one of the reasons the book gained such a fervent following; one of the others is that The Martian is a story about how science inevitably, and importantly, wins. In just about any situation, The Martian points out, if the knowledge is there, the drive is there, and the willingness to experiment is there, science will save us. (Watney's hardly the only one who knows this: Back at NASA headquarters, we see the equation-strewn chalkboard of astrodynamicist Rich Purnell, played by Donald Glover. One of Purnell's scrawled notes simply reads "SCIENCE!")

On one hand, The Martian is a movie for nerds who'll laugh at ASCII references, cheer at the phrase "Hexadecimals to the rescue," and squee when the Sojourner rover makes a cameo (squee!). On the other, The Martian is a crowd-pleasing blockbuster, and Scott doesn't shy away from the big, corny drama. But those beats work because Weir, Scott, and screenwriter Drew Goddard keep them rooted in believable, tangible science. The tragedy of Watney's story—as he survives alone, realizing an equally lonely death is never more than a minute, hour, or day away—is that the universe is uncaring. The beauty of his story—as he figures out what to build and grow and hack to survive—is that the universe is also rational.

It doesn't take an astrodynamicist to figure out the subtext here: Watney's need to survive, and the things he invents to do so, have implications and benefits for those back on Earth. And, to stretch a bit: If a dude who's been abandoned on Mars can figure out how to eat and drink and breathe, even if only for a little while? Then maybe that gives the rest of us hope that we can fix our own fucked-up planet.

Or, to put it differently: SCIENCE!