(Adds quote, updates market reaction)

SANTIAGO, Nov 22 (Reuters) - After years of divisive street protests and the election of a mainly left-wing body to rewrite the constitution, Chileans surprised analysts, markets and even themselves on Sunday night by favoring https://www.reuters.com/world/americas/chileans-head-polls-with-two-radically-different-visions-ballot-2021-11-21 a right-wing presidential candidate and delivering significant gains to conservatives in Congress.

With 99.99% of votes counted as of Monday, ultra-conservative former congressman Jose Antonio Kast had won 27.91%, and leftist lawmaker Gabriel Boric had come in second, with 25.83%. As both fell well short of the 50% threshold needed to win outright, they will now advance to a Dec. 19 runoff.

Kast, who has pledged https://www.reuters.com/world/americas/chiles-bosolonaro-hard-right-kast-rises-targeting-crime-violence-2021-11-22 to crack down on crime and illegal immigration, appears to have the momentum, though Boric can still eke out a victory if he wins over enough centrists, analysts said.

Still, the results of congressional elections may make the radical changes to Chile's free-market model that Boric has promised https://www.reuters.com/world/americas/hope-over-fear-leftist-boric-faces-struggle-capture-chiles-political-center-2021-11-22 out of reach. Leftist and center-left coalitions lost significant ground in both the upper and lower houses, and no coalition is expected to emerge with a functioning majority.

"It's going to be very difficult for any of the two major coalitions in the Senate to pass legislation," said Kenneth Bunker, head of political consultancy Tresquintos.

"For the conservative sectors, this is not a problem as they are in favor of the status quo, but for the opposition it is very bad news."

Just six months ago https://www.reuters.com/world/americas/chile-ruling-coalition-heading-disappointment-constitutional-delegates-vote-2021-05-17, Chileans had favored left-wing independents when selecting representatives to the body charged with rewriting the nation's dictatorship-era constitution. Boric, a 35-year-old who rose to fame leading student protests, has thrown his support behind the constitutional rewrite.

But crime fears, ongoing confrontations between police and separatist indigenous groups in the nation's south and fatigue with continued protests and disorder in what is traditionally one of Latin America's most stable countries likely played a role in the swing to the right, analysts said.

"What's happening in the south, combined with crime and the general idea of change without really knowing what changes will be made caused a significant portion of the population to turn against Boric," said Miguel Angel Lopez, a professor at the University of Chile.

While some recent opinion polls had shown Kast gaining ground, many Chileans and political observers did not expect him to do as well as he did, given the country's leftward turn in recent years.

"It seems sad to me, sad after everything that has happened to the country," Salvador Carrasco, a musician in central Santiago, said on Monday morning.

Chile's benchmark IPSA equities index was up over 10%, while the country's peso currency gained ground against the dollar overnight.

The rally in the peso was due to relief that Congress was split, which will act as a moderating force if Boric wins, said Mary-Therese Barton, Head of Emerging Debt at Pictet Asset Management.

"Markets' first reaction has certainly been positive. It's less to do with the presidential side and more to do with Congress," she said.

In the presidential runoff, eyes will now be on how successful both candidates will be at winning voters outside their traditional bases of support. Five failed candidates between them garnered some 46% of votes that are now up for grabs.

Perhaps the biggest mystery will be how those who voted for libertarian economist Franco Parisi will cast their votes. Parisi, who lives in Alabama and never set foot in Chile during the campaign, surprised many by finishing third with 12.8% of the vote.

"The Parisi voter is neither on the Left nor the Right," said Guillermo Holzmann, a professor at the University of Valparaiso.

"This is a vote that will need a lot of analysis."

(Reporting by Gram Slattery, Natalia A. Ramos Miranda and Fabian Cambero, Additional reporting by Reuters TV, Editing by William Maclean and Rosalba O'Brien)