Nimr had been convicted of inciting sectarian strife, sedition and other charges following his 2012 arrest.
Iran, Saudi Arabia's regional rival, summoned the Saudi ambassador in Tehran to condemn the execution, the state-run IRNA news agency reported. The Shiite-majority nation issued a statement deploring the execution and warning that Saudi Arabia would pay a heavy price for its policies.
"The execution of a personality such as Sheikh Nimr who had no means other than speech to pursue his political and religious objectives only shows the depth of imprudence and irresponsibility," Press TV cited Foreign Ministry spokesman Hossein Jaberi as saying.
That prompted a rebuttal from Saudi Arabia, which "has summoned the Iranian ambassador to the Kingdom today and handed him a strong-worded protest note on the aggressive Iranian statements issued in response to the Islamic rulings carried out on terrorists in the Kingdom," state-run SPA news agency reported.
"During the meeting (in Riyadh), the (Foreign) Ministry expressed the Kingdom's denunciation and categorical rejection to such aggressive statements, which it considers a flagrant violation into the Kingdom's internal affairs," SPA said.
Loud and angry demonstrations broke out late Saturday at the Saudi Embassy in Tehran. Video showed at least one person tossing homemade firebombs at the embassy.
A CNN producer in Tehran said some protesters even made it in the building, set fire inside and ransacked some records. There were several arrests, police officers at the embassy told CNN.
There was some damage near the back of the embassy building, witnesses and a police officer said.
None of the Saudi diplomatic staff was in the embassy at the time.
When the CNN producer got to the scene, smoke was still coming from the building. As of 3 a.m. Sunday, the protest was waning and only a few hundred people and police officers in riot gear remained.
U.S.: Saudis should respect human rights, dissenters
Human rights group Amnesty International had called the charges against Nimr vague
and pronounced his death sentence "appalling." The group said the case against him was part of a systematic effort by the majority Sunni government to crush dissent among the nation's Shiite Muslim minority.
The U.S. State Department said through a spokesman that it was calling again on Saudi Arabia to respect human rights and permit peaceful dissent.
"We are particularly concerned that the execution of (al-Nimr) risks exacerbating sectarian tensions at a time when they urgently need to be reduced," John Kirby said.
European Union High Representative for Foreign Affairs Federica Mogherini also issued a statement reacting to the executions, saying Nimr's case in particular raised "serious concerns regarding freedom of expression and the respect of basic civil and political rights."
"This case has also the potential of enflaming further the sectarian tensions that already bring so much damage to the entire region, with dangerous consequences," Mogherini said in the statement.
Shiite militant group Hezbollah condemned the execution, saying on the website of Hezbollah-run Al-Manar television that it was calling on the international community to blacklist Saudi Arabia "in the international record of criminality" for killing Nimr. It called his sentence corrupt and said Nimr was assassinated.
A spokesman for U.N. Secretary-General Ban Ki-moon said he was "deeply dismayed" by the executions and called again for an end to the death penalty. He called on leaders in the region to prevent an escalation of sectarian tensions.
However, Saudi ally Bahrain -- a majority-Shiite nation led by a Sunni King that has struggled with dissent of its own -- issued a statement supporting the executions.
"Saudi Arabia's efforts to confront whoever seeks to undermine the Nation's security and stability and wreak havoc on Earth through misguided ideology and actions that are rejected by Religion and the Islamic Shari'a are widely appreciated," said Prime Minister Sheikh Khalifa Bin Salman Al-Khalifa.
A prominent pro-ISIS channel on Telegram called for attacks on Saudi embassies, police and scholars, according to the SITE monitoring group. Telegram is an encrypted messaging service known to be used by the group's militants to communicate in secret.
Saudi: Convicted terrorists killed
Saudi officials said that the 47 executions were carried out at 12 sites after convictions for terror acts.
The condemned believed in extremist ideology and were members of terror groups, the ministry said in a statement.
Some were convicted of plotting and carrying out attacks against civilians going back as far at an attack on the U.S. Consulate in Jeddah in 2004.
Nimr, the imam of a mosque in a majority Shiite area of eastern Saudi Arabia, was an outspoken supporter of anti-government protests that broke out in 2011 -- part of the "Arab Spring"
uprisings that swept across northern Africa and the Middle East.
Shiite Muslims in Saudi Arabia have long complained of discrimination
at the hands of the nation's Sunni majority. Iran's rise as a regional power in the Middle East has exacerbated those tensions, resulting in what human rights advocates say is a systematic crackdown on minority Shiites in the kingdom.
In 2011, Nimr told the BBC
that he favored protest over violence, "the roar of the word against authorities rather than weapons."
"The weapon of the word is stronger than bullets, because authorities will profit from a battle of weapons," he told the British broadcaster.
He was arrested in 2012 following what Saudi authorities described as a car chase in which he rammed a vehicle used by security forces and resisted arrest. His family and other critics have disputed the government's account.
Authorities shot Nimr in the leg during the arrest, and his family said that he had been denied proper treatment for his wounds during his imprisonment, much of which Amnesty said was spent in solitary confinement.
A Saudi court convicted Nimr in 2014 after what Amnesty International described as a "deeply flawed" trial marked by numerous irregularities.
"Eyewitnesses, whose testimonies were the only evidence used against him, were not brought to court to testify. This violates the country's own laws," Amnesty's Said Boumedouha said in an October statement.
"The Sheikh was denied the most basic means to prepare for his defense and was not represented by legal counsel for some of the proceedings because the authorities did not inform his lawyer of some dates of the hearings," Boumedouha said.
Nimr's nephew Ali al-Nimr, who was convicted of crimes including belonging to a terror cell and attacking police, was not among those executed, according to the Interior Ministry.
Ali al-Nimr was arrested in 2012 and accused of taking part in protests against the government.
Human rights advocates, including the United Nations Office of the High Commissioner for Human Rights, have called
for his conviction to be overturned, as well. His supporters say Ali al-Nimr was a juvenile when he was arrested and was tortured into confessing to crimes.