Spain's Supreme Court cleared former judge Baltasar Garzón of overstepping his authority when he ordered an investigation into the murders of more than 100,000 people by forces loyal to late dictator Francisco Franco.
Garzón, internationally known for ordering the arrest of former Chilean dictator Augusto Pinochet in 1998, had been charged with violating a 1977 amnesty on political crimes, passed to ease the transition to democracy after Franco's rule.
The case once again exposed the divisions in Spanish society between victims of the regime, which lasted from the end of the Spanish Civil War in 1939 until Franco's death in 1975, and those whose families did not suffer during the dictatorship.
Judges voted six to one to acquit Garzon, a spokeswoman said.
Garzón said he had acted at the request of the families of victims and that international law backed him, as it had in the Pinochet case.
Garzón was disbarred for 11 years in a separate case earlier this month for illegally recording defence lawyers' conversations with clients, a ruling that could effectively end the 56-year-old's career. He plans to appeal.
The UN human rights office said earlier this month Spain must probe crimes against humanity committed during the Franco era and must repeal its amnesty for perpetrators as there is no statute of limitations for such crimes.