UPDATE 8-Swedish right opposition inches ahead in election cliff-hanger

* Social Democrat PM Andersson facing right-wing opposition

* Moderates' Kristersson has allied with Sweden Democrats

* Campaigns focus on crime, cost-of-living crisis

* Polls closed at 1800 GMT, preliminary results due Wed (Adds party leader comment, updates vote count)

By Niklas Pollard, Simon Johnson and Johan Ahlander

STOCKHOLM, Sept 11 (Reuters) - Sweden's right bloc inched into the narrowest of leads with around 90% of votes counted after Sunday's general election, with results pointing to a new government after eight years of Social Democrat rule.

Early on Monday, figures showed the Moderates, Sweden Democrats, Christian Democrats and Liberals winning 176 seats in the 349-seat parliament against 173 for the centre-left.

In further evidence of a shift to the right, the anti-immigration Sweden Democrats are set to overtake the Moderates as Sweden's second biggest party and the biggest in the opposition - a historic shift in a country that has long prided itself on tolerance and openness.

Nevertheless, Moderate leader Ulf Kristersson is likely to be the right's candidate for prime minister.

"We don't know what the result will be," Kristersson told supporters. "But I am ready to do all I can to form a new, stable and vigorous government for the whole of Sweden and all its citizens."

With overseas and some postal votes yet to be counted and the margin between the two blocs wafer-thin, results could still change. Social Democrat Prime Minister Magdalena Andersson did not concede defeat on election night, saying results were too close to call.

The election authority said a preliminary result would be available at Wednesday at the earliest.

Kristersson has said he would seek to form a government with the small Christian Democrats and, possibly, the Liberals, and only rely on Sweden Democrat support in parliament. But it may be hard for him to keep at arms length a party that is set to be bigger than his own.

"Right now it looks like there will be a change of power. Our ambition is to sit in the government," Sweden Democrat leader Jimmie Akesson told jubilant supporters at a post-election party.

"Twelve years ago we got into parliament, I think we got 5.7% finally. Right now we have 20.7%."

TOUGH ON CRIME

Campaigning had seen parties battle to be the toughest on gang crime, after a steady rise in shootings that has unnerved voters, while surging inflation and the energy crisis following the invasion of Ukraine have increasingly taken centre-stage.

While law and order issues are home turf for the right, gathering economic clouds as households and companies face sky-high power prices had been seen boosting Prime Minister Andersson, viewed as a safe pair of hands and more popular than her party.