NEW YORK (Reuters) - U.S. stocks rose and the dollar edged higher against a basket of major currencies on Thursday after the U.S. House of Representatives passed its version of a tax overhaul bill.

Traders work on the floor of the New York Stock Exchange shortly after the opening bell in New York, U.S., November 15, 2017. REUTERS/Lucas Jackson

Earnings-related gains in Wal-Mart WMT.N and Cisco CSCO.O also boosted stocks, and the MSCI index of world stocks .MIWD00000PUS rose after five consecutive daily losses.

The Dow Jones Industrial Average and the S&P 500 chalked up their biggest percentage gains in over two months.

The House approved a broad package of tax cuts affecting businesses, individuals and families, moving Republicans and President Donald Trump an important step closer to the biggest tax code overhaul in a generation.

The legislative battle now shifts to the Senate, where the Republican majority is much slimmer. Republicans can lose no more than two Senate votes and at least two GOP senators have already spoken against the Senate version of the bill.

“The tax plan isn’t a foregone conclusion but it passed the lowest hurdle in the House,” said Brian Battle, director of trading at Performance Trust Capital Partners in Chicago.

“The even higher hurdle is to have something pass in the Senate. The reconciliation will be the real measure if it happens,” he said.

The dollar index .DXY, which hit 93.813 on Wednesday, its lowest since Oct. 20, was also supported by a general improvement in risk appetite across financial markets. The index was last up 0.1 percent.

The Dow .DJI rose 187.08 points, or 0.8 percent, to 23,458.36, the S&P 500 .SPX gained 21.02 points, or 0.82 percent, to 2,585.64 and the Nasdaq Composite .IXIC added 87.08 points, or 1.3 percent, to 6,793.29.

The pan-European FTSEurofirst 300 index .FTEU3 rose 0.65 percent and MSCI's gauge of stocks across the globe .MIWD00000PUS gained 0.80 percent.

Oil prices extended their losing streak as rising U.S. production and inventories threatened to undermine a rally sparked by tightening world supply as a consequence of OPEC’s curbs on output.

U.S. crude CLc1 declined 19 cents to settle at $55.14 a barrel while Brent crude LCOc1 fell 51 cents to settle at $61.36.

U.S. Treasury two-year yields hit a nine-year high as risk appetite recovered globally and a batch of neutral to solid economic reports put the Federal Reserve on track to raise interest rates in 2018.

The rise in two-year yields pushed the curve to its flattest in a decade. The yield curve has declined for four straight days.

The gap between U.S. 2-year note and U.S. 10-year note yields contracted to 63.2 basis points US2US10=TWEBm the tightest since November 2007. The gap was last at 65.1 basis points.

In late trading, the 10-year Treasury yield US10YT=RR rose to 2.355 percent, from 2.335 percent late on Wednesday. U.S. two-year yields US2YT=RR climbed to a nine-year peak of 1.716 percent, from 1.691 percent on Wednesday. Two-year yields were last at 1.712 percent.