* Now heir apparent, young prince might rule for decades
* In charge of defence, oil, economy
* Promotion follows rapid rise
* Predecessor relieved of all posts
* Trump congratulates Mohammed bin Salman
* King asks Saudis to pledge loyalty (Adds Trump, Boris Johnson, allegiance pledging)
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 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.
U.S. President Donald Trump, who last month made Saudi Arabia his first foreign stop since his election, telephoned Mohammed bin Salman to congratulate him on his promotion.
"The two leaders discussed the priority of cutting off all support for terrorists and extremists, as well as how to resolve the ongoing dispute with Qatar," the White House said in a statement, adding they also discussed efforts to achieve a lasting peace between the Israelis and the Palestinians.
A senior U.S. official said Washington had no advance warning of the prince's promotion but could see it coming.
British Foreign Secretary Boris Johnson also welcomed the appointment. "We look forward to working closely with Prince Mohammed bin Salman and Saudi Arabia to promote long-term stability in the Middle East," he said.
Iran, Saudi Arabia's main rival for regional influence, called Prince Mohammed's appointment a "soft coup".
Its leadership was critical of comments he made last month that the "battle" should be taken into Iran, with Supreme Leader Ayatollah Ali Khamenei labelling Saudi leaders 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.
Analysts say the 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 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 of 34 members of the Allegiance Council, made up of senior members of the ruling Al Saud family. The king invited Saudis to pledge allegiance to the new crown prince.
Intent on dispelling speculation of internal divisions in the ruling dynasty, Saudi television repeatedly aired footage of Mohammed bin Nayef pledging allegiance to Mohammed bin Salman, who knelt and kissed his older cousin's hand, saying: "We will not give up taking your guidance and advice."
Senior Saudi officials, including the powerful Saudi Arabia's Senior Scholars Association, endorsed the appointment
NO POWER STRUGGLE
Analysts said the change reduces uncertainty over succession and is expected to empower 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 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.
"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 the announcement, closing more than 5 percent up on the day.
Arab leaders, including Omans Sultan Qaboos, Jordans King Abdullah and Egypt's Abdel Fattah al-Sisi congratulated Prince Mohammed bin Salman on his appointment, state media said.
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 heard of Prince Mohammed. As defence minister, he commands one of the world's biggest arms budgets and is ultimately responsible for Saudi Arabia's military adventure in Yemen.
Prince Mohammed chairs the supreme board of Aramco, making him the first royal family member to directly oversee the state oil company, long seen 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, Ali Abdelaty in Cairo and Roberta Rampton in Washington, Editing by Samia Nakhoul and Hugh Lawson and Janet Lawrence)