(Recasts, adding details and quotes)
By Winni Zhou and Andrew Galbraith
SHANGHAI, May 31 (Reuters) - China's yuan surged to its strongest level in more than 6 months on Wednesday on views that the central bank is now less inclined to allow the currency to weaken markedly against the U.S. dollar.
The u-turn in long-held market expectations has seen the yuan gain about 1 percent in the three trading days since last Wednesday, a sizable leap for a currency that normally trades in a wafer-thin range and shed 6.5 percent last year.
Spot yuan was up about 0.5 percent by the close of trade in China on Wednesday from the previous late session close, its biggest one-day gain since Jan. 17.
In Hong Kong, tight yuan supplies caused a spike in overnight borrowing rates and helped propel the offshore yuan to its highest level since November, too.
Some traders believe recent gains in the yuan and Chinese stocks were a show of strength by Beijing as it looks to scare off would-be short sellers after Moody's Investors Service cut the country's sovereign credit rating last week.
Traders last week said major state-owned banks were selling dollars in the onshore market - a move sometimes interpreted as part of the government's efforts to prop up the yuan.
But some market players and analysts had already begun to suspect that a shift in China's foreign exchange regime was in the works after a series of daily guidance or midpoint rates set by the central bank began to differ from their computer models.
The China Foreign Exchange Trade System (CFETS) trading platform, which is overseen by the central bank, confirmed on Friday that it was introducing a new factor in its calculations for the yuan's daily reference rate.
CFETS did not specify what the new "X" factor was, apart from describing it as "counter-cyclical" apparently intended to curb volatility and speculation.
The move effectively gives the People's Bank of China (PBOC) more leeway to ignore the market's views in setting the exchange rate, some analysts say.
"We infer that the authorities tired of having to intervene in the foreign exchange market to counter what they consider irrational yuan depreciation pressure," ING's Asia economist Tim Condon said in a note.
But some traders said it was not clear why authorities were making the move now. A politically sensitive leadership reshuffle will take place in China later this year, but the PBOC has already been keeping the yuan relatively steady for months, helped in large degree by weakness in the U.S. dollar.
Indeed, a Reuters poll last week showed investors had raised their bets on yuan gains to the largest since mid 2015 as the dollar flounders.
On Wednesday, the People's Bank of China set the midpoint rate at 6.8633 per dollar, compared with the previous fixing of 6.8698 on Friday.
The yuan opened at 6.8400 and hit a high of 6.8188 before ending the Chinese trading day at 6.8210. Onshore markets had been closed Monday and Tuesday for a national holiday.
The yuan was on track to gain about 1.8 percent in the first five months of the year. At the start of 2017, analysts had generally predicted a drop of around 3-5 percent for the full year.
In Hong Kong, where major state-owned Chinese banks control the flow of yuan, liquidity tightened on Wednesday, triggering dollar selling that strengthened the Chinese currency.
"The rates won't come off dramatically in the next few days, the tight liquidity would remain for at least a week. After the downgrade decision by the Moody's, the mainland government wanted to squeeze the liquidity," said one trader at a Hong Kong bank.
"They don't want speculators to attack the currency after the downgrade..."
With the introduction of the "counter-cyclical factor" in the midpoint fixing methodology, "the market understands that PBOC prefers to see a relatively stronger yuan", said Qi Gao, Asia FX Strategist at Scotiabank in Singapore.
Hong Kong's overnight yuan borrowing rate jumped to the highest point in nearly five months.
The CNH Hong Kong Interbank Offered Rate benchmark (CNH Hibor), set by the city's Treasury Markets Association (TMA), rose to 21.07933 percent for overnight contracts, the highest level since Jan.6. The previous fix was at 5.35283 percent.
The spurt in CNH funding costs discouraged short yuan traders as their borrowing costs rose dramatically.
State banks were also believed to have intervened offshore last week to sell dollars and prop up the yuan.
The offshore yuan barreled past the 6.8 level on Wednesday and was trading around 6.7750 per dollar at 0735 GMT.
Separately, the index for the yuan's value based on a trade-weighed basket fell to a fresh record low since the data was available in late 2015. (Writing by John Ruwitch; Editing by Kim Coghill)