The sailors were released on Wednesday, both the US and Iranian governments confirmed.
Iran had earlier requested an apology from the US before the release of the sailors, but it was not certain if this demand was honoured by America.
The freed officers navigated near Farsi Island, in the Persian Gulf, before they were captured on Tuesday.
Negotiations for their freedom dragged on for hours, but spokesman for the Iranian Revolutionary Guard Corps. IRGC, Ramazan Sharif, said “evidence suggests” the men “unintentionally entered the Iranian waters because of the failure of their navigational system.”
The US Navy said in a statement issued on Wednesday that, “There are no indications that the Sailors were harmed during their brief detention.”
Secretary of State, John Kerry, thanked the Iranian authorities for their cooperation.