LONDON, NOV. 27 -- John Major, a high school dropout who pulled himself up to the top ranks of government with the help of Margaret Thatcher, tonight completed his meteoric rise by winning the contest to succeed Thatcher as Britain's prime minister.

Major, who at 47 will be the country's youngest prime minister in this century, fell two votes short of an overall majority today in a three-way contest for the leadership of Conservative Party legislators. But minutes after the result was announced, his two opponents, Michael Heseltine and Douglas Hurd, dropped out of the race in the name of party unity.

Soon after, Major appeared outside the door of No. 11 Downing Street, his residence as chancellor of the exchequer, with his wife, Norma, at his side. "It is a very exciting thing to become the leader of the Conservative Party and particularly exciting, I think, to follow one of the most remarkable leaders the party has ever had," he told reporters. "Our job now is quite clear: We're going to unite totally and absolutely and we're going to win the next election."

Major is required to call a general election by mid-1992.

After Thatcher, 65, surrenders the seals of her office to Queen Elizabeth II Wednesday morning, Major will be summoned to Buckingham Palace and given the task of forming the next government. Parliament will formally approve him later in the day.

Major's selection caps one of the most extraordinary weeks in recent British political history. It saw the wrenching defeat and public humiliation of the longest serving prime minister of this century in an intense party battle, followed by the elevation to the leadership of a little-known man who has been a cabinet minister for less than four years but who had Thatcher's endorsement and support from her loyalists.

The new prime minister, a dry, wooden speaker with limited experience in the public eye, is expected to carry on the tightfisted, free-market economic policies of his predecessor. But many analysts, citing Major's working-class origins and his public statements, believe he will adopt a more liberal approach to social welfare issues and Britain's future role in a united Europe.

Nonetheless, the result was sweet revenge for Thatcher, who was forced to resign as prime minister last week after failing to win enough votes to defeat Heseltine in the first round of balloting. Major and Hurd then entered the contest and Thatcherites threw their support to her chancellor to stop Heseltine, her most bitter Tory rival.

Thatcher said tonight she was "thrilled" at Major's victory and urged the party to unite behind him.

Major won 185 votes, two short of the simple majority he needed from the 372 Conservative members of the House of Commons. Heseltine had 131 votes, and Hurd 56.

It was a tough loss for Heseltine, 57, the former defense secretary who stunned Conservatives by winning 152 votes against Thatcher just a week ago. But it was clear that some of those who supported him last week were using him as a stalking horse to depose the prime minister and abandoned him in the second ballot to vote for their real preference -- Major or Hurd.

Hurd, 60, the patrician foreign secretary, was supposed to be the compromise candidate who would heal the party's wounds. But Major surprised many supporters by jumping into the race as well. He quickly lined up private backing from Thatcher and public support from most of her supporters, who were furious at Heseltine for his "betrayal" of their leader and sought out the candidate most committed to carrying on her policies.

Major presided over a whirlwind five-day campaign with the services of some of the same media advisers who had helped Thatcher engineer three straight electoral triumphs. He also benefited from weekend polls showing that the Conservative Party under his leadership would do as well as or better than it would under Heseltine against the resurgent Labor Party.

The campaign and the polls together produced a bandwagon effect that persuaded wavering lawmakers to go with Major, despite the fact that many were uneasy about his inexperience, analysts said.

Major is expected to keep Hurd as foreign secretary and Tom King as defense secretary, and analysts expect no change in Britain's steadfast support for U.S. policy in the Persian Gulf crisis. He is also expected to offer Heseltine a cabinet-level post.

Heseltine was the first to react to the result. He said, "My purpose is to ensure that unity is achieved at once in order that we may go on to win the general election," and he hailed "the dawn of a new era of Conservative administration."

Hurd spoke also of the need for party unity and added, "There's no bitterness in my disappointment because I think everyone's agreed it's been a very good fight." Hurd said Major "will be an excellent prime minister."

British opposition leaders were quick to tie Major to Thatcher's increasingly unpopular policies and Britain's economic troubles and predicted the Conservative Party's sudden rise in opinion polls would prove temporary. Paddy Ashdown, leader of the minority Liberal Democrats, said Major was offering "Thatcherism with a different face."

Labor Party leader Neil Kinnock called Major "a Thatcherette . . . Mr. High Mortgage, Mr. Rising Unemployment." He added, "The British people wanted change, and the Tory party is giving more of the same. . . . I want a general election and I want it now."

French television reacted to Major's victory with cries of "Maggie's pet," "remote-controlled," and "victor by default," Reuter reported.

According to White House press secretary Marlin Fitzwater, President Bush called Major to say he looked forward to working with him and "to maintain the special relationship with the United Kingdom."

While Major must show gratitude to Thatcher for her support, analysts say he quickly will have to find ways to distance himself from some of her policies, especially her hated new system of local taxation known as the poll tax. Major, like his rivals, has promised a "thorough review" of the measure but will face pressure from lawmakers to scrap it altogether and return to the old property tax.

Thatcher did not publicly endorse Major, but made clear through her aides that he had her support. There were reports today -- denied by her staff -- that she had phoned several wavering lawmakers to enlist their support for Major and had upbraided the one cabinet minister, David Hunt, who had declared for Heseltine. She reportedly told party staffers at a farewell session Monday, "I shan't be pulling the levers there, but I shall be a very good back-seat driver."

But Major's supporters said he would quickly show his independence. "John Major is absolutely nobody's puppet," said David Mellor, a deputy cabinet minister and close friend. "John Major is his own man and has always been. He is someone with very different opinions on a range of issues."

BRITISH PRIME MINISTERS SINCE WORLD WAR II

.....................Age When...........Party....In Office

......................Elected

Winston Churchill.......65 ........Conservative*...1940-45

Clement Attlee..........62 ........Labor...........1945-51

Winston Churchill...... 76.........Conservative....1951-55

Anthony Eden........... 57.........Conservative....1955-57

Harold Macmillan........62.........Conservative....1957-63

Alec Douglas-Home.......60.........Conservative....1963-64

Harold Wilson...........48.........Labor...........1964-70

Edward Heath............53.........Conservative....1970-74

Harold Wilson...........57.........Labor...........1974-76

James Callaghan.........64.........Labor...........1976-79

Margaret Thatcher.......53.........Conservative....1979-90

*Churchill headed a coalition government during the war years.

Compiled by James Schwartz -- The Washington Post