The official IRNA news agency said on Wednesday that the yachtsmen were released after an interrogation by Iranian authorities found "that their illegal entry was a mistake".
Iran had warned on Tuesday the sailors would be prosecuted if it was proven they had "bad intentions".
However, Britain said it was an innocent case of a vessel accidentally going astray into the Arabian Gulf.
The detentions, announced by Britain on Monday, came after The Kingdom of Bahrain yacht veered into Iranian waters while travelling from Bahrain to Dubai.
Britain had earlier called in Iran's ambassador to London on Tuesday to voice "increasing concern" over the detention of the five yachtsmen, as the sailors' boss said a mechanical problem had likely led to their seizure.
Andrew Pindar, chairman of the Sail Bahrain team which owns the sailors' yacht, said it may have drifted into Iranian waters due to a damaged propeller.
"We received a call from the crew stating that they had been stopped by an Iranian navy vessel," he said in a statement.
"We understood that the crew believed they were in UAE waters, but due to a fault with the propeller, they may have inadvertently drifted into Iranian waters."
They were believed to have been intercepted near the Iranian-controlled island of Abu Musa, whose ownership is disputed by Iran and the United Arab Emirates.
The crew have been named as Oliver Smith, Oliver Young, Sam Usher, Luke Porter and David Bloomer, according to informed sources in London.