The second Borg attack on the Federation came in 2373. A single cube again attempted to reach Earth and assimilate its population.1
By this time Starfleet had been building up its forces in the core of the Federation for several years in response to the Romulan, Borg and Dominion threats; five hundred Starships met the Borg ship at the Typhon sector1
and fought a four day running battle all the way to Earth. Starfleet managed to inflict significant damage on the cube's outer hull, but the Borg inflicted massive losses on the fleet in the process.1
By the time the cube reached Earth some three hundred and twenty ships had been lost, most of them with all hands.
The Enterprise-E arrived at the battle, in violation of orders, as the Borg entered orbit. Captain Picard was able to use his knowledge of the borg to locate a weak point on the hull, and by concentrating the firepower of the few remaining ships on that spot the cube was successfully destroyed. However, the Borg launched a spherical escape pod of some kind as the cube was destroyed, and this ship generated a temporal vortex in order to go into the past and assimilate Earth there. The sphere attacked the launch site of Zefram Cochrane's warp ship, damaging the vessel and killing many of the support staff. They hoped that this would prevent First Contact between the Humans and Vulcans, thus preventing the creation of the Federation. The Enterprise followed the sphere through the vortex and destroyed it, although a group of Borg transported to the Starship and almost assimilated the ship. Eventually the Enterprise crew where successful in both overcoming this attack and correcting the damage done to the past.1