Retired senior diplomat Juergen Chrobog, his wife and three sons were freed by the kidnappers on Saturday, the ministry said.
Frank-Walter Steinmeier, the foreign minister, who predicted this week that the family would be freed before the end of the year, was due to hold a press conference on the release later on Saturday.
The official Yemeni news agency Saba has also confirmed the release, saying the family was freed on Saturday afternoon along with three Yemeni drivers.
"The five German hostages who were kidnapped in Shabwa province were released this afternoon, with their three Yemeni drivers," the agency said.
Chrobog, 65, and his family were abducted five days ago from a restaurant on the road between the port city of Aden and Shabwa, which is 480km east of the capital Sanaa.
Their release followed mediation efforts by a team made up of tribal chiefs and government representatives who negotiated with the hostage-takers.
Tribal chief Shaikh al-Ahmar Ali al-Aswad was said by tribal sources to have been holding the Germans as bargaining chips for the release of the five brothers he says were wrongly imprisoned by the Yemeni authorities.
It was not known if the conditions for the release of the hostages were fulfilled.
Chrobog served as German ambassador to the United States from 1995 to 2001. He was also as foreign ministry state secretary under former chancellor Gerhard Schroeder and was seen as a gifted crisis manager.
He helped secure the release of 14 German tourists taken hostage in Mali in August 2003.