A privately operated SpaceX Dragon cargo has docked with the International Space Station after surviving a potentially critical failure.
The unmanned capsule is carrying more than 1,000 kilograms of supplies, science experiments and spare parts on behalf of Nasa for the second of its 12 planned resupply missions worth $1.6 billion in contracts.
It blasted off from Cape Canaveral on Friday atop a SpaceX Falcon 9 rocket.
But shortly after it reached orbit the craft suffered a massive failure in its thruster rocket pods, which threatened to end the mission in failure.
Three out of four of the capsule's thrusters did not activate as planned once it reached orbit.
That left the craft unable to make manoeuvres to reach the Space Station and dock with the astronauts on board.
Nasa and SpaceX said that there was a blockage in the line which pressurises the thrusters.
After several hours of troubleshooting, however, the thrusters were brought back online. Space X founder Elon Musk said that there was "no leakage" and described the problem as a "glitch".
"It was a little frightening there," he admitted.
The Dragon eventually docked with ISS on Sunday, when station commander Kevin Ford used a Canadian-built robotic arm to grab the capsule.
"It's not where you start but where you finish that counts. You guys really finished this one on the mark," Ford told the SpaceX team back in California.
"What a fantastic day."
The capsule will now be unpacked over several days - but a gift of fresh fruit placed in the craft by its president will be eaten at once.
It will then be reloaded with 1,300 kilograms of spent supplies and scientific samples before heading back to Earth.
Another firm - Orbital Sciences Corp - will send its out privately-built resupply capsule to the ISS later this year.