He will then head to his hometown of Elgoibar about 150 kilometres (90 miles) to the north, where his supporters will hold celebrations to mark his return.
Batasuna has been banned since 2003 for being the "political wing" of Eta, which is blamed for over 820 killings in its campaign of bombings and shootings to create an independent Basque homeland in northern Spain and southwestern France.
Batasuna re-emerged as a legal pro-independence party, Sortu, which advocates for independence through democratic means.
Otegi was elected its secretary general in 2013 while in jail.
"The sentence was unjust and disproportionate, even jurists said so, as he had for a long time advocated for peace and the end of violence," journalist and Basque specialist Gorka Landaburu, who lost the sight of one eye due to an Eta letter bomb in 2002, told AFP.
Spain's former crusading judge Baltasar Garzon, who ordered Otegi's arrest in 2009, backed his release.
"He can do much more outside than inside jail for peace," Garzon said last year.
Catalan journalist Antoni Batista, who covered the Basque Country for 25 years and recently published a biography of Otegi, describes him as a "European Nelson Mandela".
"Otegi is the man who has contributed the most to put an end to Eta violence," he told AFP.
A Basque Gerry Adams
An active member of Eta since the age of 19, Otegi has spent a total of 15 years behind bars.
In the 1990s he became one of the first Eta members to call for disarmament, earning him comparisons to Northern Ireland's Gerry Adams, the former head of the political wing of the Irish republican Army (IRA).
In 2006-2007, Otegi was one of the main architects of peace negotiations between Eta and the Spanish government.
The talks broke down, largely because a bombing at Madrid airport in December 2006 that left two dead. The attack was carried out by Eta militants who opposed disarmament.
Dozens of people with links to ETA were arrested, including Otegi.
In October 2011 Eta declared a "definitive end to armed activity" but it has yet to formally disband or disarm.
Some of Otegi's opponents see him as an imposter.
"Otegi is not a man of peace," centre-right daily newspaper El Mundo wrote on Monday in an editorial.
"He is a defender of extortion, kidnapping and assassination."
In 2012 Otegi presented his "most sincere apology" for having contributed to the "pain" and "humiliation" of Eta victims.
Both his supporters and detractors predict he will play an important role, especially in regional elections slated for year-end in the Basque Country.
He will not be eligible to run for office until 2022, although he can contest this restriction in court.
By Laurence Boutreux