The moon is passing through space and the command crew monitor an approaching meteor. Its course will take it safely past the moon, but it suddenly changes course and plummets toward Moonbase Alpha. As the crew base for impact, the asteroid suddenly changes course again, passes narrowly overhead, and explodes in space. The crew scans ahead and learns that some strange black mass is in their path.
Koenig sends pilot Mike Ryan in Eagle one to investigate the mass while Bergman checks his calculations to determine what it is. Mike fires a laser into the mass without affect and his transmission signal begins to weaken. The pilot flies closer to get a better reading, switching on his anti-gravity shields to full. Bergman completes his calculations and realizes that the object is a black sun, with nearly infinite gravitational attraction. Koenig orders Mike to change course but it's too late: the Eagle is pulled in until the gravitational forces crush it.
The moon is three days away from impact with the black sun and the command crew tries to come up with a solution. Bergman comes up with a plan and demonstrates that they can use the eight towers that provide Moonbase Alpha with its gravity to generate an anti-gravitational force field. The force field will use the black sun's own gravitational forces to reinforce their own energies, protecting the moon.
The Alphans removes the generators from all the Eagles but one to power the gravity towers. Once they're ready, Koenig and Bergman don spacesuits and go out on the moon's surface. Alan fires a laser at them from the remaining Eagle and the force fields work, deflecting the beam. Dr. Russell isn't happy they risked themselves needlessly but Koenig insists that they needed to raise crew morale by demonstrating that the project was a success. Besides, if it had failed then they would have only died one day sooner. Koenig then informs Dr. Russell of his backup plan: they will use the remaining Eagle as a lifeboat for six Alphans.
While Bergman and Kano argue whether to keep Computer going, Paul informs Koenig that the black sun's gravitational pull is increasing as they draw nearer, reducing their safety margin by six hours. The only way to slow themselves down is to activate the force field prematurely. Koenig does so against Bergman's advice, draining much of the life support energies. One of the towers gives out from the power stresses and the backlash electrocutes Bergman. Only his mechanical heart saves him from death.
Koenig continues to maintain the force fields, draining their life support further. The command crew prepares the lifeboat and Alan Carter finds out about the plan. He angrily insists that he has to fly it as the only pilot capable of getting them to safety. Koenig agrees and announces the names of the other five passengers chosen by Computer as the ones most likely to survive. Among them are Dr. Russell and Sandra. Bergman isn't surprised to learn that Koenig disqualified himself. Koenig tells the lifeboat passengers that they'll have enough supplies for five weeks. Dr. Russell initially refuses to go but Koenig insists that the choices are final. He does admit that it makes a difference to him that she departs for safety.
The lifeboat crew prepare for departure and everyone gives them a final goodbye. Temperature in Alpha continue to drop and Bergman brings Koenig thermal gear, while telling them that there chances of survival are slim. The professor violates Dr. Russell's standing orders and lights up a cigar despite his heart condition.
As the moon approaches the black sun, Bergman wonders if some cosmic intelligence might be responsible for their continued survival despite incredible odds. Koenig dismisses Paul, noting there's no point on him staying on station. Bergman brings out a bottle of whiskey and pours a toast for himself and Koenig. Meanwhile, the Alphans quietly gather and pursues their personal interests while waiting for the end.
The moon finally enters the black sun and Koenig and Bergman are supplied to discover that while the force field is holding, they have turned into ghostly figures.
On the lifeboat Eagle, the passengers discover that they have also started to transform.
Within seconds, Bergman and Koenig age hundreds of years. The professor wonders if they even exist any more, and realizes that he can hear Koenig's thoughts and vice versa. The two of them share each others thoughts and ideas and they realize simple solutions to complex scientific equations. A voice speaks to them, saying it's a friend and asks them to join it. The two men step into a glowing field and realizing that they are looking at the stars as if they were close-at-hand. The voice says that it exists on a different timescale, and they never heard it speak to them before. Bergman wonders if they are conversing with God but the voice makes no response except to wish them well on their journey.
The moon travels clear of the black sun and everything reverts to normal. The Alphans discover that they are in a totally different part of the universe and wonder how they'll find the lifeboat. However, the lifeboat appears on a course for them, somehow having traveled with them. Upon touchdown, Alan explains that they went in the opposite direction from the black sun and there's no way they could have found the moon. Bergman has no idea what happened but Dr. Russell insists that something or someone brought them to their home: Alpha.