NEW YORK (AP) -- The U.S. stock market edged lower Wednesday, ending a four-day rally, as a drop in energy shares and jitters over Greece outweighed encouraging earnings reports from banks.
Energy stocks slumped along with the price of oil after a report showed that a drop in U.S. supplies last week was less than expected.
The market's pause follows strong gains. Stocks have surged in the past week as a slump in China's stock market abated and Greece reached a deal with its creditors for more loans to avoid bankruptcy and a possible exit from the euro.
Greece's deal with its creditors must still be approved by the country's lawmakers. As investors waited for a vote in the nation's parliament, protesters clashed with police in the streets of Athens. The protesters want an end to the harsh austerity measures demanded by Greece's creditors in exchange for more loans.
"You come in some days and it looks like it's all clear and that Greece has been resolved, and the next day it hasn't," said Michael Scanlon, portfolio manager with John Hancock Asset Management.
The Standard & Poor's 500 index edged down 1.55 points, or less than 0.1 percent, to 2,107.40. The Dow Jones industrial average slipped 3.41 points, or less than 0.1 percent, to 18,050.17. The Nasdaq composite fell 5.95 points, or 0.1 percent, to 5,098.94.
The U.S. stock market started the day higher after encouraging second-quarter results from banks, including Bank of America.
The bank said its profit more than doubled thanks to lower legal bills. It also said an increase in deposits, lower expenses and an improving balance sheet helped offset a decline in revenue.
The bank's stock rose 55 cents, or 3.2 percent, to $17.68.
Investors were also following Federal Reserve Chair Janet Yellen's comments to the House Financial Services Committee.
Yellen told Congress she sees encouraging signs that the economy is reviving after a harsh winter. If the improvements continue, she said, policymakers will likely start raising interest rates later this year. The Fed has kept its benchmark rate near zero since December 2008, pushing up bond and stock prices.
Yellen was flagging the possibility of higher rates so as not to surprise investors when the Fed does eventually lift them, said Quincy Krosby, a market strategist for Prudential Financial.
"That's the last thing she wants to do," said Krosby. "That's why we have to pay attention when she says that (a rate increase) is on the table."
Among individual stocks, Macy's was the biggest gainer in the S&P 500. The stock jumped on reports that activist investor firm Starboard Value thinks the department store chain could boost its value by spinning off its real estate holdings. Macy's climbed $5.28, or 7.9 percent, to $72.01.
In energy trading, benchmark U.S. crude fell $1.63, or 3 percent, to close at $51.41 a barrel, as a report on supplies showed a smaller-than-expected decline last week. The price of oil has fallen 13 percent this month.
Oil has come under further pressure after Iran reached a nuclear deal with world powers. That paves the way for sanctions on the country to be lifted, allowing Iran to export oil and add to a glut in global supply.
In government bond trading, prices rose. The yield on the 10-year Treasury note fell to 2.36 percent from 2.40 percent on Tuesday.
The dollar rose to 123.78 yen from 123.35 yen. The euro was down slightly to $1.0950 from $1.1010.
In metals trading, silver fell 27 cents to $15.03 an ounce. Gold dropped $6.10 to $1,147.40 an ounce. Copper declined 1.4 cents to $2.53 a pound.
In other futures trading on the New York Mercantile Exchange:
-- Wholesale gasoline fell 7 cents to close at $1.86 a gallon.
-- Heating oil slipped 5.6 cents to close at $1.67 a gallon.
-- Natural gas rose 8 cents to close at $2.92 per 1,000 cubic feet.