Captain Jean-Luc Picard awakens from a nightmare about his Borg assimilation experience to an incoming message from Admiral Hayes. Hayes informs Picard that Deep Space Five reported that a colony has been destroyed. Completing the Admiral's sentence, Picard realizes who destroyed the colony — the Borg.
Picard calls a meeting and informs his senior officers that their ship has been instructed to patrol the Neutral Zone. Their orders are to protect the area from any possible Romulan uprising during a Borg attack. Despite protests from his officers, Picard remains faithful to his orders and the U.S.S. Enterprise NCC 1701-E begins to patrol the area. Later, Picard regretfully tells Riker that it is his own fault they are stuck in the Neutral Zone. Starfleet believes Picard to be too emotionally involved with the Borg because of his previous assimilation to tactically complete a mission against them.
The men return to the bridge to learn that Starfleet has engaged in combat with the Borg. Intercepting messages between the starships, the crew learns that the Federation is losing. Picard, with his Borg experience, knows he can help the fleet. He informs his staff that he will make a decision directly in opposition to Starfleet commands. With no objections from his crew, Captain Picard gives the order and the starship Enterprise sets a course for Earth and the attacking Borg cube.
A massive battle ensues and it appears that the Federation will lose the fight. Despite serious structural damage to the Borg cube, their strength does not weaken. Even the U.S.S. Defiant, commanded by Worf, does not appear to be able to turn the tides of the battle. As the starship Defiant is about to ram the Borg ship on a suicide run, the U.S.S. Enterprise beams aboard its crew, including Worf. Picard, having an inside perspective of the Borg and their vessel, focuses the firepower of the fleet on coordinates he knows to be critical. Just as the main ship is destroyed, a spherical escape pod flies out. The sphere creates a temporal vortex, catching the starship Enterprise in its wake. Immune to the paradoxes created by the time travel, the starship's crew learns that Earth at the present time appears to be inhabited entirely by the Borg. The commanding officers realize that the Borg have gone into the past and assimilated Earth, so they follow them back in time to repair the damage the Borg have done.
On Earth, over three centuries earlier, a somber Lily Sloane accompanies a stumbling, drunk Zefram Cochrane out of a bar after a night of revelry. Then, Lily notices a fast moving light. She hardly has time to ask what the object is, when the Borg vessel attacks. Back aboard the Enterprise, Picard demands that Data tell him the exact date and location the Borg ship is attacking. The location: central Montana. The date: April 4, 2063 — the day before First Contact. Realizing that the Borg have come to prevent first contact between alien life forms and humans, the crew knows they must stop the Borg and facilitate this exchange. They destroy the Borg sphere, and Dr. Crusher, Captain Picard, Commander Data, Commander Riker, Counselor Troi and other U.S.S. Enterprise crew transport down to Earth to survey the damage.
At the Borg attack site in Montana, the crew finds destruction and chaos. They split into groups to search for Cochrane. Data and Picard hunt for Cochrane's warp ship, the Phoenix. There they encounter a very angry and confused Lily, who believes Data and Picard to be members of a coalition that broke the cease-fire after World War III. She shoots at them in a rage, but impervious to bullets, Data approaches Lily. Overcome by fear and radiation, she falls to the ground. Dr. Crusher diagnoses Lily with radiation sickness caused by the damaged Phoenix, and inoculates the entire crew. Against Picard's better judgment, Crusher takes Lily to sickbay. Geordi is called to help repair the warp vessel and Picard becomes intrigued by its historical significance. In this vessel began the future as the world would know it, and the past as Picard remembers it. He reaches out to touch the ship. Data, curious about the human need for tactile reinforcement, attempts to create the same feelings he observes in Picard, but is unsuccessful in duplicating this aspect of humanity.
Aboard the ship, two crewmembers are sent to examine unexplained maintenance problems, and both disappear. Picard is called to the ship and discovers that the survivors from the Borg sphere have transported onto the ship and are taking over Deck 16. While Picard arranges teams to fight them, the Borg manipulate the climate of the deck to suit their needs and begin to spread throughout the ship. When the Borg attack sickbay, Crusher, her staff, and Lily escape through a Jeffries tube, thanks to a distraction by the ship's Emergency Medical Hologram. While Crusher leads the group down the passageway, Lily steals away in a different direction.
On Earth, Riker finds Troi and Cochrane drunk in a bar. Troi justifies that the only way she could get Cochrane to talk to her was by shooting Tequila with him. Denying her drunken state, Troi offers her professional opinion on Cochrane. She explains, "He's nuts."
Picard and his team are tracking the Borg through the starship. As Crusher and her staff find Worf's team, Picard's team encounters the Borg, who have begun to assimilate U.S.S. Enterprise crewmembers. Worf's team engages the Borg in combat, but the enemies adapt to the crew's weapons too quickly to make any difference. The teams are ordered to regroup on Deck 15, but Data is captured. Picard cannot save him, so he quickly crawls into a Jeffries tube to escape. Face to face with Picard, Lily steals his phaser and demands an explanation and escape route. Picard agrees.
Geordi shows Cochrane the starship Enterprise through a large telescope on Earth and tries to convince him to launch his vessel the next morning. Geordi glorifies Cochrane by explaining that his ship will make first contact with alien life forms. Humanity will be saved if Cochrane launches his ship. Still drunk, Cochrane agrees.
Aboard the ship, the Borg Queen introduces herself to a bound Data, claiming that she is the Collective. Reactivating Data's emotion chip, the Borg begin to graph organic, human skin onto the android's arm. As Data is overcome by this new human sensation of touch, something he never thought possible, the Borg continue their work.
Lily and Picard wander through the service deck as the captain attempts to explain what has happened between Lily's time and his own. She begins to calm down until they suddenly run into a Borg-infested area. Quickly escaping in the Holodeck, Picard activates a Dixon Hill program. At a dance, he and Lily try to blend in without being noticed by the Borg. Following the Holodeck's story, Picard searches for Nicky the Nose and takes his machine gun. Killing the Borg with the gun, Picard retrieves the memory chip that contains all of the information the Borg has received. Lily then notices that the two dead Borg were once crewmembers of the U.S.S. Enterprise.
Back on Earth, Cochrane keeps hearing what an amazing historical figure he is and begins to question whether or not he wants to go through with the launch. He doubts his own nobility and flees the launch site. Geordi and Riker attempt to catch up with Cochrane in the woods and are forced to stun him with a phaser to return him to the Phoenix.
Lily and Picard join the rest of the surviving crew and discover that the Borg are outside of the ship. The retrieved memory chip reveals that they are reconfiguring the main deflector in order to contact the Borg of this century, calling them to Earth to assimilate the planet. Picard, Worf and Lieutenant Hawk put on space suits and venture onto the surface of the starship to stop the Borg.
Aware of Data's desire to become human, the Borg Queen offers him the chance to be entirely covered in human flesh and join the Borg, in an attempt to get the encryption codes from Data so she can obtain total control over the U.S.S. Enterprise. Outside the Enterprise, Hawk, Worf and Picard attempt to unlock the deflector dish. Attacked by a Borg, Worf's suit begins to depressurize. Two Borg are killed and Hawk is attacked. As the dish is released, a now-assimilated Hawk attempts to kill Picard. Worf saves the captain, but Hawk is killed. Picard and Worf then destroy the free-floating deflector dish.
On Earth, Cochrane explains to Riker that his only motivation for inventing warp travel was money. He never expected to save mankind, become a hero, or be instrumental in the founding of a new civilization. He simply wanted to retire in peace.
An argument ensues aboard the Enterprise as the majority of the senior officers believe that they should evacuate the ship, destroying it and the Borg. Picard won't give up, and insists they stay. Challenged by Worf, Picard orders him off the Bridge. Lily follows Picard into his ready room and demands that he explain his obsession with fighting the Borg. Picard declares he won't sacrifice the starship, and swears to finally make the Borg pay for all they've done. Lily quietly and calmly compares Picard to Captain Ahab, forever fighting his white whale — the Borg. Realizing that this fight could only destroy himself and his crew, Picard decides to evacuate the ship. Worf, Picard and Crusher activate the ship's self-destruct sequence. The countdown begins, and the crew leaves in escape pods. Picard surveys his ship and prepares to leave when he hears Data calling him.
Meanwhile , the earth-bound crew and Cochrane begin takeoff. Cochrane, Geordi and Riker take off in the Phoenix, and with music blaring, the three men launch successfully into orbit.
On the ship, Lily and Picard say good-bye and the captain goes to save Data. Entering Engineering, Picard confronts the Borg Queen, whom he knows from his experience with the Borg. The queen reminds Picard that it was not enough that he was assimilated, but that he needed to give himself freely to the Borg — she wished him to stand by her side as an equal to further the power of the Collective. Picard offers himself in exchange for Data, but the android does not comply. He refuses to leave, and at the queen's command, disarms the self-destruct sequence. He quickly enters the encryption codes, offering full control of the Enterprise to the Borg.
As Cochrane's ship nears warp, Data arms the U.S.S Enterprise's weapons and aims them at the defenseless Phoenix. At the Borg Queen's order, Data fires, but the missiles fail to hit the Phoenix. His deception of the Borg complete, Data smashes a conduit, releasing a gas that floods engineering, killing all organic material. As the Borg are destroyed, Picard climbs to safety and the Borg Queen falls into the deadly gas. With the Borg threat gone, Cochrane safely completes humanity's first warp flight.
Celebrating the flight back on Earth that night, Cochrane and the Enterprise crew see an alien ship land nearby. The doors open, and Zefram Cochrane makes Earth's first contact with an alien race — the Vulcans. Picard and his crew beam out, having witnessed this historic event, and the U.S.S Enterprise NCC 1701-E returns to the 24th century.