Foreign investors returned as net buyers of Japanese stocks for the first time in three weeks as of Dec. 7, drawn by a surge in local shares and scaled-back expectations for a rate hike by the Bank of Japan.

Foreigners purchased 482.3 billion yen ($3.17 billion) worth of Japanese stocks during the week, the most on a weekly net basis since Nov. 9, data from the Ministry of Finance showed.

A record-setting rally on Wall Street lifted spirits in global markets, propelling Japan's benchmark Nikkei index to a near two-month high of 40,091.55 on Thursday.

Foreigners have purchased about 2.35 trillion yen worth of Japanese stocks so far this year, compared with about 3.19 trillion yen worth of net purchases in the same period last year.

There were substantial foreign inflows into Japan's bond market as well last week. Foreigners pumped a net 1.59 trillion yen into short-term bills, the biggest amount in seven weeks, while acquiring a net 1.01 trillion yen worth of long-term debt.

At the same time, Japanese investors divested a net 954.8 billion yen worth of overseas equities, logging their largest weekly net sale in five weeks.

They also ditched foreign long-term bonds worth about 640.8 billion yen, posting a third weekly net withdrawal in four weeks. ($1 = 152.2600 yen)

(Reporting by Gaurav Dogra and Patturaja Murugaboopathy in Bengaluru; Editing by Savio D'Souza)