NEW YORK — U.S. stocks rose Tuesday, ending their longest losing streak since January, amid better-than-forecast earnings and as Chinese equities pulled back from a selloff.

NEW YORK — U.S. stocks rose Tuesday, ending their longest losing streak since January, amid better-than-forecast earnings and as Chinese equities pulled back from a selloff.


United Parcel Service advanced 5.1 percent, and Pfizer gained 2.9 percent after their profits beat projections. Energy shares rallied with oil, and Freeport-McMoRan led raw-material producers higher as copper climbed. Baidu fell 15 percent after forecasting sales that were below analysts’ targets. Ingersoll-Rand lost 6.6 percent as earnings missed estimates.


The Standard & Poor’s 500 Index increased 1.2 percent to 2,093.25, as the gauge climbed the most in two weeks to hit its average price during the past 100 days. The Dow Jones industrial average added 189.68 points, or 1.1 percent, to 17,630.27 after Monday reaching its lowest level since February. The Nasdaq composite index rose 1 percent.


"China slowed the big selloff it saw yesterday, and that’s lifting the U.S. market," said Terry Morris, a senior equity manager who helps oversee about $2.8 billion at Wyomissing, Pennsylvania-based National Penn Investors Trust. "Reported earnings have been OK so far, and we’ll get a lot more reports to digest as the week goes along."


Chinese equities lost 1.7 percent Tuesday, after sinking as much as 5.1 percent. Shares tumbled 8.5 percent Monday amid weaker-than-expected economic data and concern that a three-week rally sparked by unprecedented government intervention is unsustainable.


The S&P 500 fell 2.9 percent in the previous five sessions as a Chinese stock rout spurred concern about the nation’s economic growth and some corporate earnings disappointed. The index has declined for four of the last five weeks and is up 1.5 percent this month, after nearly erasing its July gain Monday.


Federal Reserve policy makers began a two-day meeting Tuesday to assess the strength of economic growth and debate the timing for higher interest rates. While economists see no chance the central bank will raise rates this week, they put the odds of a September boost at about 50 percent, a Bloomberg survey published July 22 showed.


Fed Chair Janet Yellen has signaled that the central bank is likely to lift rates this year, and emphasized that the pace of subsequent increases would be gradual.


A report Tuesday showed home prices in 20 U.S. cities rose at a slower pace in the year ended May. Separate data showed consumer confidence slumped in July by the most since August 2011 as Americans became less upbeat about prospects for the economy, employment and their finances.


Investors are also watching the earnings season, with more than 100 members of the S&P 500 yet to report this week. Of the firms that have already done so, more than three-quarters beat profit estimates and about half topped sales forecasts. Analysts have moderated estimates for a drop in second-quarter earnings to 4 percent, from 6.4 percent on July 10.


The Chicago Board Options Exchange volatility index slipped 14 percent Tuesday to 13.44, after reaching a two-week high Monday. The gauge rose 15 percent last week, its fifth gain in six weeks. About 7.4 billion shares traded hands on U.S. exchanges, 15 percent above the three-month average.


All of the S&P 500’s 10 main groups advanced, led by energy and raw-material shares amid a reprieve in a two-week commodities selloff. The energy group rallied 3 percent, the biggest jump since February 2. Exxon Mobil surged 4.1 percent, its best advance since 2011. Southwestern Energy rose 6.8 percent, the most since October, after cutting its spending outlook and raising its production forecasts.


Chesapeake Energy increased 7.5 percent, after dropping about 28 percent in the seven sessions endingMonday. Diamond Offshore Drilling climbed 3.6 percent. The price of crude oil gained for the first time in five trading sessions, with West Texas Intermediate futures adding 1.2 percent.


Raw-material shares in the S&P 500 rebounded from a nine- day skid to rise 2.2 percent as copper prices bounced back from a six-year low. Freeport-McMoRan, the largest publicly-traded copper miner, surged 8.4 percent amid plans for more investment cutbacks and cost savings.


Eastman Chemical gained 6.8 percent after reporting earnings that beat analyst forecasts. Ecolab rallied 5 percent, the biggest advance in almost four years, to end a seven-session losing streak. Dow Chemical climbed 2.2 percent to also halt a seven-day slump.


Gains in Masco and UPS helped pushed a group of S&P 500 industrial companies to their strongest climb since January. Masco jumped 11 percent to an eight-year high after the building-products maker’s quarterly profit beat estimates. UPS turned in its best gain in more than five years.


Caterpillar increased 3.3 percent, the most since March, after announcing an accelerated $1.5 billion stock repurchase from Citigroup’s Citibank.


The Dow Jones transportation average jumped 2.7 percent, the biggest climb in six months, buoyed by UPS. Railroads Kansas City Southern and Union Pacific climbed at least 4.5 percent.


Ford rose 1.9 percent after posting a surge in second-quarter profits, thanks to consumers paying big money for fully-loaded versions of the new aluminum-bodied F-150 pickup.


Baidu dropped the most since November 2008 after China’s largest search engine company projected sales for this quarter that trailed analysts’ estimates amid a weakening economy. China is on course for its slowest pace of annual growth in a quarter- century, and Baidu earns virtually all of its revenue in the country.


DuPont lost 1.5 percent after cutting its full-year profit forecast to adjust for the spinoff of its performance chemicals unit and the impact of lower crop prices, which are causing farmers to spend less on the company’s pesticides and seeds.


——


With assistance from Trista Kelley in London.