U.S. stocks ended sharply higher Wednesday and the Nasdaq logged a record-high close, led by a rebound in technology and health-care stocks and optimism that Greece will avoid defaulting on its debt.

Reports that Athens and its creditors were near a deal pushed the euro higher against the dollar, partly reversing recent moves. European Union officials, however, dismissed Greek claims that an aid agreement was being drafted.

Investors said U.S. stocks were oversold in the previous session, when concerns about Greece and foreign exchange pushed Wall Street to its steepest fall in three weeks.

The Standard and Poor’s 500-stock index has inched up to a handful of record-high closes in May. But the stock market has failed to make what some traders see as meaningful gains, in part because investors are concerned about when the Federal Reserve will start to raise interest rates for the first time since 2006.

The Dow Jones industrial average rose 121.45 points, or 0.7 percent, to end at 18,162.99 points. The S&P 500 gained 19.28 points, or 0.9 percent, to 2123.48, and the Nasdaq rose 73.84 points, or 1.5 percent, to 5106.59.

It was the S&P’s strongest day since May 14 and the Nasdaq’s strongest since late January, lifting it to its first record close since April 24.

Nine of the 10 major S&P 500 sectors ended higher, with technology up 1.8 percent and the health index up 1.1 percent.

Broadcom surged 21.8 percent on news that the chipmaker was in talks to be bought by Avago Technologies. Avago jumped 7.8 percent.

Gilead Sciences rose 2.5 percent and led gains on the S&P health index.

The energy sector was off 0.1 percent as the rising dollar weighed on oil prices. The Dow Jones airlines index broke a five-day losing streak to rally 2.2 percent.

Michael Kors dropped 24.2 percent after the handbag maker reported its slowest quarterly revenue growth since going public.

Coach fell 3.3 percent, Kate Spade was off 4.7 percent and Fossil dropped 6.5 percent on Michael Kors’s report of lower tourist traffic, weak watch demand and shipping delays because of West Coast port disruptions.