At first, “Sunshine” sounds like nothing more than a corny science-fiction tale: The sun is dying, so we send a ship loaded with a nuclear bomb to try to re-ignite it. This is the stuff of loud, dumb disaster flicks like “Armageddon” and “The Core,” isn’t it?

True enough. What makes “Sunshine” different is that it was directed by Danny Boyle, of “Trainspotting” and “28 Days Later” fame, and written by frequent collaborator Alex Garland. Boyle brought freshness to the drug-addict drama and the zombie horror, and he does it again for the sci-fi thriller with “Sunshine.” It’s more compelling and engrossing than any sci-fi film of the last few years.

In the not-too-distant future, eight astronauts on the Icarus II have embarked on a mission to drop a bomb into the sun, a last-ditch effort to save the Earth from the permanent winter it now finds itself in. It’s not a suicide mission — the plan gives them four minutes to hightail it out of range before detonation — but everyone onboard is aware that there are serious risks involved. The bomb itself has a mass equaling that of Manhattan, and making it has sapped all of Earth’s dwindling resources. We made one seven years ago, for the Icarus I, but that ship fell out of communication and evidently never completed its mission. This is our second — and last — chance.

It goes without saying that there are complications. The first arrives when, in the last few days of the ship’s voyage toward the sun, the crew hears a distress signal from the Icarus I. It’s more than likely that no one is left alive and that the signal is automated. But if the ship is intact, it may have supplies that our crew can use. Furthermore, if it never dropped its payload, that second bomb might come in handy as a spare.

The question is, do we veer slightly off-course to investigate, or do we ignore Icarus I and proceed as scheduled? The ship’s captain, Kaneda (Hiroyuki Sanada), looks to his crew to decide. The physicist, Capa (Cillian Murphy), a gentle and soft-spoken wisp of a man, says the likely benefits of the diversion outweigh the potential risks and that they should do it. The engineer, Mace (Chris Evans), whose overabundance of machismo has already provoked fights, says they should not stray from the assigned mission in the least degree.

Capa’s plan is adopted, and a new course is set. The shift in direction, coupled with human error on the part of navigator Trey (Benedict Wong), causes damage to the ship’s heat shields, however, and a setback that occurs during their repair causes Trey to lose what’s left of his fragile, guilt-ridden mind.

I said there are complications. I just named two of them, and yet I have barely scratched the surface. What sounds like a tedious, claustrophobic story — set entirely onboard a spaceship with only eight characters and one mission — is in fact multi-faceted and surprising, thanks to Garland’s smart script and Boyle’s outstanding visual style. Boyle more than adequately conveys the hugeness of the ship, the vastness of the sun, the emptiness of space, and the twin feelings of awe and terror that would necessarily accompany a journey like this one. We sense what the characters knew when they signed up for the mission: On the one hand, this is awesome. On the other hand, we will probably die.

Nearly everyone onboard recognizes that sacrifice may be necessary, from the calm psychologist Searle (Cliff Curtis), to the biologist Corazon (Michelle Yeoh), to the pilot Cassie (Rose Byrne), and particularly to Mace, who seems eager to be a martyr when martyrdom is called for. Only the ship’s communications officer (Troy Garity) is obsessed with survival — a natural tendency, but one that stands out as starkly ugly against the backdrop of heroism.

Or is it even heroism? It might just be pragmatism. Everyone on the crew knows that the lives of several billion Earth inhabitants are at stake here. When oxygen becomes limited and sacrifices are necessary, the decisions are made with unsettling precision and cold logic.

Everyone is obsessed with something, though. The doctor is fascinated by the sun itself, and keeps asking the ship to allow more and more light into the observation room, his sunburned face bearing the consequences of that. Trey cannot get past his simple mistake that cost a crew member’s life. Corazon loves the garden that provides the ship with fresh oxygen, and is devastated when it is compromised, for reasons that go beyond the immediate concern of O2 depletion. Mace insists on following the original course and the original mission. He’s not above saying “I told you so” when things go wrong, either.

Boyle and Garland obviously owe a lot to quite a few other space movies: “Alien,” “2001,” maybe the original “Solaris,” a little “Event Horizon,” probably plenty of others I’m not familiar with. The filmmakers have made no secret of this in interviews, and nothing in “Sunshine” feels like a “rip-off.” Just because you’re building a house out of the same materials as all the other houses doesn’t mean it can’t be new and interesting.

As new perils emerge in the film’s last couple reels, the suspense and tension increase exponentially, and there’s a point where I can’t keep up with what, exactly, the characters are trying to do. More details earlier on about the specifics of launching the bomb and what’s entailed might have cleared up some of that confusion.

The characters aren’t all fully developed (the two women suffer in that regard in particular), but the ones with the most screen time — Mace, Capa, Searle — emerge as real portraits of flawed humans in dire circumstances. It’s especially remarkable that, given the constraints of the genre, Boyle doesn’t fill the thing with the usual character cliches. Mace might be the quintessential hothead, but he’s a believable hothead (and played with a maturity that may be surprising, given Chris Evans’ association with the insubstantial “Fantastic Four” movies).

Cillian Murphy, the Irish actor with the pale blue eyes who is best known for his work in “28 Days Later” and “Batman Begins,” is “Sunshine’s” narrator and emotional center. All of the film has a dark sense of foreboding about it, but Murphy gives it weight and poignance early on when he records a message to send back to his family on Earth. He observes that if the mission is successful, it will take eight minutes for the new light to reach Earth. “So if you wake up one morning and it’s a particularly beautiful day…you’ll know we made it,” he says. That line is used in the film’s trailer, where it seems almost glib. In its proper context, though, it humanizes the movie and helps to express its far-out sci-fi themes in real, understandable terms.

Most films in which “the fate of the world” is at stake fail to convince us of that. We don’t truly feel the importance of what the heroes are doing, largely because the heroes themselves tend to be wise-cracking and cavalier about it, like saving the world is no big deal. “Sunshine” takes the opposite tack. The film is entertaining and fun in the usual ways, but there’s never any doubt about how seriously the characters are taking it. They act the way people would act if the fate of the world really were at stake.

B+ (1 hr., 47 min.; R, a lot of harsh profanity, some violence.)