© Reuters.

Investing.com - Stocks rallied on Friday, closing out the quarter with the best gains for the broader market in almost a decade, buoyed by fresh signs the U.S. and China are nearing an end to their bitter trade dispute.

The added 0.67% for the day and was up 13.1% for the first quarter. That's its best performance since the third quarter of 2009, when the broad-market index rose nearly 15%.

The rose 0.82% today, while the rallied 0.78%.

Trade Representative Robert Lighthizer and Treasury Secretary Steven Mnuchin concluded their two-day meeting in Beijing, with both sides touting progress on the latest round of trade talks.

Mnuchin described the talks as "constructive," ahead of another set of talks with China’s Vice Premier Liu He in Washington next week.

Positive sentiment on trade has gathered momentum this week as both sides have appeared to be willing to find common ground, easing investor worries that both nations were on a collision course.

The U.S. has hinted that it may lift tariffs on China. Beijing reportedly is warming up to the idea of an enforcement framework, which the Trump administration argues is important to ensure China complies with eventual terms of a trade deal.

The optimism on trade was captured by trade-sensitive industrials, with Boeing (NYSE: ) and Caterpillar (NYSE: ) ending the day higher. The two accounted for nearly a third of the Dow's 211-point gain.

Trade aside, consumer discretionaries also boosted the broader market thanks to a in CarMax (NYSE: ) after the used-car re-seller posted better-than-expected quarterly earnings.

In health care, Celgene (NASDAQ: ) rallied as independent proxy advisory firms Institutional Shareholder Services and Glass Lewis & Co. backed Bristol-Myers Squibb's (NYSE: ) merger proposal for the company.

The move prompted hedge fund Starboard Value to retract its proxy solicitation to vote against the deal, paving the way for a merger.

"While Starboard Value is still opposed to the deal, we now think it is much more likely that the BMY-CELG transaction will go through. Wellington Management Company, another huge opponent of the deal, has not provided any updated comment," said CFRA, an independent research provider.

The transaction is expected to close in the third quarter, subject to shareholder approval.

Sentiment on tech was boosted by gains in chip stocks, led by a 5% surge in Micron (NASDAQ: ) on expectations the chipmaker may benefit from Samsung's (KS: ) DRAM quality issues.

Given Amazon's issues with Samsung, the e-commerce giant may reach out to Micron/Hynix, which would afford the two parties the ability to gain market share, CLSA said in a note.

Real Estate and energy stocks were the exception to the Wall Street rally , with the latter unable to capitalize on gains in U.S. oil prices, which posted their best quarter since 2009.

On the economic front, a trio of reports showing a rebound in , and added somewhat to expectations the Fed could soon cut interest rates.

Calls for a rate cut strengthened late Friday as White House economic adviser Larry Kudlow told Axios the Fed should "immediately" cut interest rates by 50 basis points.

Top S&P 500 Gainers and Losers Today:

CarMax (NYSE: ), Celgene (NASDAQ: ) and Micron Technology (NASDAQ: ) were among the top S&P 500 gainers for the session.

PVH (NYSE: ), Helmerich & Payne (NYSE: ) and Take-Two Interactive (NASDAQ: ) were among the worst S&P 500 performers of the session.