The victim, Jose Maria Lidon, was shot at close range by two masked men as he got into his car in Getxo at around 0730 local time (0630 GMT).
The BBC's Madrid correspondent, Flora Botsford, says both attacks are characteristic of the Basque separatist group ETA.
The authorities say Judge Lidon was not on any known ETA hit-list.
However, in 1987 he took part in a trial in which six young ETA sympathisers were sentenced to long jail terms for an attack on a Socialist Party office in northern Spain.
Condemnation
The president of the Basque region's Association of Professional Magistrates, Judge Antonio Garcia, said the killing of the judge was a "barbaric act carried out by that band of lunatics who are impossible to get rid of".
Two people suspected of belonging to ETA have already been arrested for the Madrid attack, after a member of the public chased them in his car while keeping in contact with police by mobile phone.
A senior government official whose car had passed the scene seconds earlier - and was the possible target of the attack - suffered minor cuts.
"ETA attacks everyone it can," Justice Minister Angel Acebes said. "Yesterday it attacked a government official, other times it attacks police and today it attacked the judiciary."
ETA has openly declared that it considers all members of the judiciary, the security forces, and political institutions as legitimate targets.
At least four of those injured in Tuesday's blast were seriously hurt, including a mother and her three-year-old daughter, said Spanish Interior Minister Mariano Rajoy.
Six people remain in hospital.
Government spokesman Pio Cabanillas said the explosion was
powerful enough to have caused a "real massacre".
Last week police arrested 13 members of a support group for ETA prisoners, of whom 11 have been charged with terrorism offences.
ETA has killed some 800 people over the last 33 years in its struggle to achieve independence for the Basque region.