(Refiles to remove extraneous words in paragraph 6)
* Now heir apparent, young prince might rule for decades
* In charge of defence, oil, economy
* Promotion follows rapid rise
* Predecessor relieved of all posts
* King asks Saudis to pledge loyalty
DUBAI, June 21 (Reuters) - Saudi Arabia's King Salman made his son next in line to the throne on Wednesday, handing the 31-year-old sweeping powers as the kingdom seeks radical overhaul of its oil-dependent economy and faces mounting tensions with regional rival Iran.
Although Mohammed bin Salman's promotion to crown prince had long been expected among those who follow the royal family closely, the timing was a surprise, and puts the kingdom's future in relatively untested hands.
Mohammed bin Salman replaces his cousin, Prince Mohammed bin Nayef, a veteran security chief who led the Saudi campaign against Islamic State and al Qaeda, at a time when Riyadh faces heightened tensions with Qatar and Iran and is locked into a war in Yemen.
His appointment may make Saudi policy more hawkish against arch-rival Iran and other Gulf rivals such as Qatar, increasing volatility in an already unstable region, analysts say.
"Under his watch, Saudi Arabia has developed aggressive foreign policies (Yemen, Qatar) and he has not been shy about making strong statements against Iran," said Olivier Jakob at Switzerland-based oil consultancy Petromatrix.
"It is not really a question of if, but rather of when, a new escalation with Iran starts," he added.
Iran, Saudi Arabia's main rival for regional influence, called Prince Mohammed's appointment a "soft coup".
Its leadership was critical of comments by Prince Mohammed last month that the "battle" should be taken into Iran, with Supreme Leader Ayatollah Ali Khamenei labelling the Saudi leaders then as "idiots".
Iran, which is predominantly Shi'ite Muslim, and Saudi Arabia, which is mostly Sunni, compete for power and influence across the region. The two countries support opposite sides in the conflicts in both Syria and Yemen.
U.S. President Donald Trump made his first speech abroad in Riyadh last month, aligning with the views of his hosts in singling out Iran as a source of support for militant groups. He met separately with Mohammed bin Salman during the visit.
Washington did not have advance warning of the young prince's promotion but could see it coming, a senior U.S. administration official said.
"This is why the president has tried to foster good relations with him," the official told Reuters.
Analysts say the young prince's rapid rise has created friction within the ruling family, however, and made Saudi policy less predictable than in recent decades.
Saudi royal family: http://tmsnrt.rs/2rVcsD4
The reshuffle sparked speculation on Twitter about a possible future abdication by the octogenarian King Salman bin Abdulaziz Al Saud in favour of his son, whose youth and dynamism have appealed to younger Saudis who make up the majority in society and are often eager for change.
After decades in which the same small group of princes handled Saudi affairs on the world stage, Prince Mohammed has led diplomacy with global powers, reportedly charming both U.S. President Donald Trump and Russian President Vladimir Putin.
He was appointed crown prince and deputy prime minister by royal decree, but he retains the defence portfolio and still controls oil and economic policies.
Mohammed bin Nayef, the king's nephew and a counter-terrorism chief admired in Washington for putting down an al Qaeda campaign of bombings in 2003-06, was relieved of all his posts, according to the decree.
The decree said the decision by King Salman to promote his son and consolidate his power was endorsed by 31 out of 34 members of the Allegiance Council, made up of senior members of the ruling Al Saud family.
Intent on dispelling speculation of internal divisions in the ruling dynasty, Saudi television was quick to show that the change in succession was amicable and supported by the family.
Throughout the early morning it repeatedly aired footage of Mohammed bin Nayef pledging allegiance to the younger Mohammed bin Salman, who knelt and kissed his older cousin's hand.
"I am content," Prince Mohammed bin Nayef said. Prince Mohammed bin Salman replied: "We will not give up taking your guidance and advice."
NO POWER STRUGGLE
Analysts said the change ends uncertainty over succession and empowers Mohammed bin Salman to move faster with his plan to reduce the kingdom's dependence on oil, which includes the partial privatisation of state oil company Aramco.
"The change is a huge boost to the economic reform programme... Prince Mohammed bin Salman (MbS) is its architect," said John Sfakianakis, director of the Gulf Research Centre.
Bernard Haykel, professor of Near Eastern Studies at Princeton, said the king's decision was aimed at avoiding a power struggle between his son and Mohammed bin Nayef by setting the line of succession out clearly.
"It's clearly a transition that has happened smoothly and bloodlessly. Now it's clear, it's straightforward. That kind of clarity lowers the risk. There's no question as to who's going to be in charge."
Saudi Arabia's stock market surged after Prince Mohammed's promotion was announced, closing more than 5 percent up on the day.
"Some people were predicting that this would lead to a division in the family and strife and some kind of revolt. I don't see that happening," Haykel said.
Arab leaders, including Omans Sultan Qaboos, Jordans King Abdullah, Egypt's Abdel Fattah al-Sisi and Yemeni President Abd-Rabbu Mansour Hadi congratulated Prince Mohammed bin Salman on his appointment, according to state media.
The royal decree did not nominate a new deputy crown prince. The position is relatively new in Saudi Arabia, where kings have traditionally chosen their own successors.
In an apparent attempt to appease the family, the decree had a clause that made clear that Mohammed bin Salman wont be allowed to appoint one of his own sons as his successor.
It also appointed young princes from other branches of the family to government roles, seemingly to reassure them that they will remain part of the ruling structure.
As deputy crown prince, Mohammed bin Salman has been responsible for running Saudi Arabia's war in Yemen, dictating an energy policy with global implications and spearheading plans for the kingdom to build an economic future after oil.
POWER BEHIND THE THRONE
Until his father became Saudi Arabia's seventh king in January 2015, few people outside the kingdom had ever heard of Prince Mohammed.
He is currently defence minister, giving him command of one of the world's biggest arms budgets and making him ultimately responsible for Saudi Arabia's military adventure in Yemen.
Prince Mohammed chairs the supreme board of Aramco, making him the first member of the ruling family to directly oversee the state oil company, long regarded as the preserve of commoner technocrats.
But perhaps most importantly, he is the gatekeeper to his father, King Salman, who in Saudi Arabia's absolute monarchy retains the final say in any major decision of state.
Outside Saudi Arabia, that rapid rise and the sudden changes to longstanding policies on regional affairs, energy and its economy have prompted unease, adding an unpredictable edge to a kingdom that allies long regarded as a known quantity.
Inside, they have prompted admiration among many younger Saudis who regard his ascent as evidence that their generation is taking a central place in running a country whose patriarchal traditions have for decades made power the province of the old.
(Reporting by Stephen Kalin, William Maclean, Rania El Gamal, Sylvia Westall, Sami Aboudi, Andrew Torchia, Reem Shamseddine, Angus McDowall; Editing by Samia Nakhoul and Hugh Lawson)