Stocks edged higher Wednesday after the Federal Reserve reassured investors it was in no rush to raise interest rates from historically low levels.
The central bank said that the economy is strengthening, but not enough for policymakers to signal an imminent rate hike. The Fed's benchmark rate has remained near zero for more than six years in an effort to bolster the economy and encourage borrowing, lending and investment.
Surging stocks and ultra-low rates have gone hand-in-hand over the last six years, pushing the market to all-time highs.
"This makes the market feel more confident," said Alan Rechtschaffen, financial advisor at UBS Wealth Management Americas.
As the economy has recovered investors have been trying to gauge not only when the Fed will begin raising rates, but also how aggressively it will move. Investors worry that if rates climb too quickly, the economy will slump.
The Dow Jones industrial average gained 31.26 points, or 0.2 percent, to 17,935.74. The Standard & Poor's 500 index rose 4.15 points, or 0.2 percent, to 2,100.44. The Nasdaq composite rose 9.33 points, or 0.2 percent, to 5,064.88.
Bond prices also rose after the Fed released its statement at 2 p.m. Eastern time. The yield on the 10-year Treasury note fell to 2.31 percent from 2.38 percent just before the statement was released.
Fed Chair Janet Yellen told reporters after a two-day policy meeting that the central bank needs to see more gains in employment and stronger signs of inflation before raising rates. She didn't provide a timetable for an increase, but most economists expect the Fed to move later this year.
Utilities gained the most of the 10 sectors in the S&P 500.
Investors buy the dividend-rich stocks to provide them with an income. Low rates make them look attractive compared to bonds.
The major stock indexes remain close to their record highs set in May, but have sagged in the past month as investors have focused on the outlook for rates.
The Dow is still up 0.6 percent this year despite dropping 2 percent from its last record close on May 19. The S&P 500 is up 2 percent for the year and off 1.4 percent from its high on May 21.
Aside from the Fed, investors were also keeping an eye on negotiation between Greece and its lenders.
Greece remains deadlocked in talks with its creditors Wednesday and there was little sign of a breakthrough a day ahead of a meeting of the 19 finance ministers from countries that use the euro. Greece needs to get more loans before the end of the month, when its bailout program expires and it is scheduled to make a big payment to the International Monetary Fund.
European markets have slumped in the last month as the talks have failed to produce an agreement. Greek markets are suffering the most. The nation's benchmark index sank 3 percent Wednesday and is down 18 percent this year.
Yields on Greek government bonds have surged as investors' confidence in the country's ability to pay its debt has waned. The yield on the Greek 10-year government bond has climbed to 13 percent from 6 percent a year ago.
Back in the U.S., investors welcomed the latest round of corporate deals.
Kythera Biopharmaceuticals surged 22.1 percent to $74.11 after Botox maker Allergan agreed to buy the drugmaker for about $2.1 billion. The deal would add a product that reduces double chins to Allergan's portfolio. Allergan added 77 cents to $298.79.
Medical technology company Hill-Rom Holdings climbed 6.3 percent to $55.70 after it agreed to buy privately held rival Welch Allyn for about $2.05 billion in a cash-and-stock deal.
In energy trading, the price of U.S. oil ended little changed after a volatile day. Oil prices had sagged after the Energy Department's weekly supply report showed a surprise increase in gasoline inventories.
Benchmark U.S. crude fell 5 cents to close at $59.92 a barrel in New York. Brent crude, a benchmark for international oil used by many U.S. refineries, rose 17 cents to close at $63.87 in London.
In metals trading, gold prices slipped $4.10, or 0.3 percent, to $1,176 an ounce. Silver fell 2 cents to $15.95 an ounce and copper dropped 1 cent to $2.60 an ounce.
In other futures trading, wholesale gasoline fell 2.4 cents to close at $2.101 a gallon. Heating oil rose 2.5 cents to close at $1.910 a gallon. Natural gas fell 3.9 cents to close at $2.855 per 1,000 cubic feet.