NEW YORK (AP) -- Stocks climbed broadly on Tuesday as investors who had been fretting over the Greek debt crisis and plunging Chinese stocks turned their attention back to the U.S. economy and corporate earnings reports.
The market rose broadly after JPMorgan Chase and Johnson & Johnson reported second-quarter profits that were stronger than expected. A government report showed that Americans cut back on spending at retailers last month, but some investors interpreted that as good for stocks since it may make the Federal Reserve more cautious when it starts raising rates for the first time in nine years.
"It's back to the mindset that bad news is good news," said James Abate, chief investment officer of Centre Funds. "We think (the Fed) will raise rates in September, but we don't think it will be an aggressive tightening cycle."
The gains were modest, but broad. Among the 10 industry sectors of the Standard and Poor's 500 index, only utilities fell. It was the fourth straight gain in a row for the broader index.
The S&P 500 increased 9.35 points, or 0.5 percent, to 2,108.95. The Dow Jones industrial average gained 75.90 points, or 0.4 percent, to 18,053.58. The Nasdaq composite climbed 33.38 points, or 0.7 percent, to 5,104.89.
The Commerce Department said retail sales slipped 0.3 percent in June, the weakest showing since February. That followed a robust 1 percent jump in May. A separate report from National Federation of Independent Business showed an index of small business optimism fell in June.
Investors were also keeping an eye on Greece after the country struck a preliminary deal with its creditors. Prime Minister Alexis Tsipras has to convince lawmakers to approve tax hikes and spending cuts by Wednesday to receive emergency money and re-open the country's banks, but he faced dissent even within his left-wing party.
Peter Cardillo, chief economist at Rockwell Global, a brokerage firm, thinks the Greek crisis may still spook the stock market. He said investors seemed to be more focused Tuesday on earnings, and hoping some decent reports so far will continue and buck the currently low expectations investors have.
"The earnings announcements are probably going to be the real driving force of the markets over the next few weeks," Cardillo said.
Earnings for companies in the S&P 500 index are expected to fall 4.4 percent compared with the prior year, according to S&P Capital IQ. That would be the first drop since 2009.
Companies reporting in the coming days include Delta Air Lines and Netflix on Wednesday, Ebay and Google on Thursday and General Electric on Friday.
Among stocks making big moves, loan servicing company Navient cut its earnings forecast because of weakened credit trends on some student loans and a drop in loans that are coming out of deferment compared with previous years. Its stock plunged $1.94, or 10.6 percent, to $16.42.
Micron Technology jumped 11 percent on reports that a Chinese company is preparing a $23 billion bid for the chip maker in what would be China's largest takeover of a U.S. company. Some media reports said that Tsinghua Unigroup Ltd. would bid $21 per Micron share, and that an offer could come this week. Micron gained $2 to $19.61.
Twitter briefly spiked 8.5 percent after a fake story said the company received a $31 billion buyout offer. The story appeared on a website made to look like Bloomberg's business news page. A Bloomberg spokesman said the story was bogus. Twitter closed up 94 cents, or 2.6 percent, to $36.72.
The main Chinese index lost 1.2 percent after three straight gains. The government has been trying to lift stocks after the Shanghai Composite Index lost as much as 30 percent over the past month. Among other measures, executives and big shareholders have been barred from selling. Analysts say it is unclear whether the market can hold up once the barriers to selling are relaxed.
In oil trading, benchmark U.S. crude rose 84 cents to close at $53.04 a barrel in New York. Brent crude, a benchmark for international oils used by many U.S. refineries, rose 66 cents to close at $58.51 a barrel in London.
In other futures trading on the New York Mercantile Exchange:
--- Wholesale gasoline fell 0.9 cents to close at $1.931 a gallon.
--- Heating oil rose 0.7 cent to close at $1.725 a gallon.
--- Natural gas fell 2.4 cents to close at $2.840 per 1,000 cubic feet.
U.S. government bond prices rose. The yield on the 10-year Treasury note fell to 2.40 percent from 2.45 percent late Monday.
Precious and industrial metals futures closed lower. Gold lost $1.90 to $1,153.50 an ounce, silver fell 14 cents to $15.30 an ounce and copper gave up a penny to close at $2.54 a pound.