File photo: Armored vehicles take part in a military drill on the borders with Azerbaijan and Armenia. AP
The move marks a thaw between Azerbaijan and Iran a week after their foreign ministers agreed to resolve a crisis in ties through dialogue.
Azerbaijan's customs department said Thursday it had handed over the drivers to the Iranian side in a decision "guided by principles of humanitarianism, mutual respect and good neighbourliness".
The standoff between the countries was sparked by allegations from Tehran that its sworn enemy Israel maintained a military presence in Azerbaijan. Baku denied the claims.
Iran vowed to take any necessary action and staged military drills near its border with Azerbaijan.
Azerbaijan's Foreign Minister Jeyhun Bayramov spoke last week by phone with his Iranian counterpart Hossein Amir-Abdollahian and the pair agreed to resolve differences through dialogue.
Israel is a major arms supplier to Azerbaijan, which late last year won a six-week war with neighbour Armenia for control of the disputed Nagorno-Karabakh region.
Azerbaijan and Iran have long been at loggerheads over Tehran's backing of Armenia in the decades-long Nagorno-Karabakh conflict.
The war last year ended with a Russian-brokered ceasefire that saw Armenia cede swathes of territory -- including a section of Azerbaijan's 700-kilometre (430-mile) border with Iran.
Baku said the drivers entered Azerbaijan through that territory, bypassing border control to avoid customs duties it had imposed recently -- to Iran's fury on cargo transit to Armenia.
Tehran has long been wary of separatist sentiment among its ethnic Azeri minority, who make up around 10 million of Iran's 83 million population.