Technology companies have soared as major US stock indexes recovered the ground they lost a day earlier.
The Nasdaq composite closed at another all-time high.
Big names such as Apple and Microsoft and chipmakers including Intel all made big gains as investors remain optimistic about the technology sector even though much of the market has been shaken by escalating tensions between the US and its trading partners, especially China.
Industrial companies also regained much of the ground they lost on Wednesday but energy companies and basic materials makers failed to rally.
Defence contractors climbed after President Donald Trump advocated for more defence spending in the US and Europe.
The S&P 500 index rise 24.27 points, or 0.9%, to 2,798.29. The Dow Jones Industrial Average rose 224.44 points, or 0.9%, to 24,924.89.
The Nasdaq jumped 107.30 points, or 1.4%, to 7,823.92. Its last record came on June 20.
The Russell 2000 index of smaller-company stocks added 6.61 points, or 0.4%, to 1,690.28.
Software maker CA made the biggest gain in the technology sector and soared after it accepted an offer from Broadcom worth 18.9 billion US dollars (£14.3 billion), or 44.50 dollars per share.
Its stock rocketed 18.7% to 44.15 dollars. Broadcom investors expressed their disapproval of the deal, which involves Broadcom taking on 18 billion dollars (£14 billion) in debt. The stock dropped 13.7% to $209.98.
Broadcom’s market value fell by 14.4 billion dollars (£11 billion).
Mr Trump continued to criticise other Nato members at the group’s summit in Brussels. He said European countries should raise their defence spending and suggested the US should also keep spending more.
Several European leaders said Nato spending plans have not changed.
Lockheed Martin gained 2.2% to 313.31 dollars and Raytheon rose 1.8% to 197.52 dollars.
The merry-go-round of potential media deals continued as Comcast offered to buy European pay-TV company Sky for 34 billion dollars (£36 billion) a day after 21st Century Fox increased its own offer for Sky.
Fox already owns 39% of Sky and while it tangles with Comcast, Comcast and Disney are also trying to buy Fox itself.
Fox recently accepted Disney’s 71 billion dollar (£54 billion) offer from Disney. The New York Times reported Comcast will focus on Sky and end its pursuit of Fox.
Sky’s stock rose 3.4% in London. In the US, Comcast rose 2.3% to 34.55 dollars and Fox fell 0.9% to 47.38 dollars. Disney gained 0.2% to 108.25 dollars.
Papa John’s International jumped 11% to 53.67 dollars as founder John Schnatter resigned as chairman after confirming a report that he had used a racial slur during a conference call in May.
Stifel analyst Christopher Cull said Wall Street has viewed the company as a potential sale target for some time and investors feel that’s more likely without Mr Schnatter in charge. But since Mr Schnatter is still is largest shareholder, Mr Cull does not think that will happen.
He owns about 29% of the company’s stock and the value of his stake jumped by 50.5 million dollars (£38 million) to about 507 million (£384 million) dollars in total.
Stocks around the world slumped on Wednesday after the Trump administration released a list of 200 billion dollars (£151 billion) in imports from China that it could hit with a 10% tax.
China said it would retaliate if the tariffs take effect, and the dispute could impair global economic growth.
Stocks overseas took bigger losses than US indexes did and they made small recoveries on Thursday. In Paris, the French CAC 40 climbed 1%. Germany’s DAX added 0.6% and the Britain FTSE 100 rose 0.8%.
Tokyo’s Nikkei 225 gained 1.2% and Hong Kong’s Hang Seng gained 0.7%. Seoul’s Kospi added 0.2%.
Benchmark US crude dipped 0.1% to 70.33 dollars a barrel in New York while Brent crude, used to price international oils, rose 1.4% to 74.45 dollars per barrel in London.
US crude dropped 5% on Wednesday and Brent nosedived almost 7% as investors worried that the trade conflict will hurt the global economy. They also expect oil supplies to increase after Libya announced that it will start exporting oil again.
Wholesale gasoline added 0.5% to $2.07 a gallon. Heating oil rose 1.1% to 2.12 dollars a gallon. Natural gas fell 1.1% to 2.80 dollars per 1,000 cubic feet.
Bond prices ticked higher. The yield on the 10-year Treasury note fell to 2.85% from 2.86%.
Gold rose 0.2% to 1,246.60 dollars an ounce. Silver gained 1% to 15.98 dollars an ounce. Copper rose 1.2% to 2.78 dollars a pound after it fell to an 11-month low on Wednesday.
The dollar rose to 112.46 yen after it jumped to 112.04 yen a day ago. The euro edged down to 1.1670 dollars from 1.1674 dollars.