NEW YORK (AP) -- After four days of modest losses, Apple and Amazon led the U.S. stock market to small gains on Thursday. Internet and health care companies rose while mining companies fell with metals prices.
Apple and Amazon are the two most valuable U.S. companies, and analysts said each stock should keep climbing. Other market favorites including Facebook and Google parent Alphabet also rose.
Interest rates slipped for a second day, which led to losses for banks, while the stronger dollar weighed on metals prices and on shares of the companies that mine those metals. Smaller companies, which have struggled in September, also fell.
Scott Wren, senior global equity strategist for the Wells Fargo Investment Institute, said investors have been reluctant to get back into the stock market since the 2008-09 recession, and there are signs that's changing.
"Retail investors have been underinvested for this whole expansion," he said. "The economy is decent. The market is correctly pricing in a relatively low possibility of an all-out trade war."
The S&P 500 index rose 8.03 points, or 0.3 percent, to 2,914. Despite its recent losing streak, the benchmark index is up more than 7 percent since the end of June. With one day left in the third quarter, the S&P 500 is on track for its best quarter since the end of 2013.
The Dow Jones Industrial Average gained 54.65 points, or 0.2 percent, to 26,439.93. The Nasdaq composite climbed 51.60 points, or 0.6 percent, to 8,041.97. The Russell 2000 index of smaller-company stocks dipped 1.08 points, or 0.1 percent, to 1,690.53.
Apple rose after JPMorgan Chase analyst Samik Chatterjee said the stock could climb another 20 percent by the end of next year. Chatterjee said the company was successfully building up its services businesses such as music and payments, which could bring in 20 percent of Apple's annual revenue in the next few years. Chatterjee said the company might make acquisitions in the gaming, automotive or smart speaker businesses.
Apple rose 2.1 percent to $224.95. Elsewhere in the technology sector, Salesforce.com rose 1.3 percent to $160.43. Internet companies also rose. Alphabet rose 1.1 percent to $1,207.36 and Facebook rose 1.1 percent to $168.84.
Amazon rose 1.9 percent to $2,012.98 after Stifel analyst Scott Devitt forecast more revenue for its retail, advertising and web services units and raised his price target to $2,525 a share. That would value Amazon at about $1.2 trillion.
Wren, of Wells Fargo, said many smaller investors have been reluctant to put too much money in the stock market, and with more U.S. workers nearing retirement age, that is probably not going to change. Some experts worry when retail investors hurry into the market because it can be a sign stock prices are going to get too high. But Wren said he's not concerned about that possibility yet.
Bed Bath & Beyond plunged 21 percent to $14.86 after the home goods and furnishings company reported earnings that fell far short of what analysts were expecting. The company also lowered its profit forecast for the rest of the year and said it expects lower sales. Its stock closed at its lowest price since March 2000 and has dropped from $75 in less than four years.
Several other companies that reported quarterly results also traded lower. Conagra Brands, the parent of Chef Boyardee and Hebrew National, fell 8.5 percent to $32.98 after its profit and sales fell short of Wall Street projections. Cruise line operator Carnival gave up 4.8 percent to $63.74 after it said prices for recent bookings have been lower than they were a year ago.
Tesla took a small loss during the day and then dropped 6.1 percent in aftermarket trading after the Securities Commission filed a complaint against CEO Elon Musk. The complaint says Musk made false statements about a plan to take the electric car maker private.
Benchmark U.S. crude rose 0.8 percent to $72.12 per barrel in New York while Brent crude, used to price international oils, added 0.5 percent to $81.72 per barrel in London.
Wholesale gasoline rose 1.2 percent to $2.08 a gallon. Heating oil gained 1 percent to $2.32 a gallon. Natural gas rose 2.6 percent to $3.06 per 1,000 cubic feet.
Bond prices rose again. The yield on the 10-year Treasury note fell to 3.05 percent from 3.06 percent.
The ICE U.S. Dollar index climbed 0.8 percent, which pushed metals prices lower. Gold slid 1 percent to $1,187.40 an ounce. Silver lost 0.8 percent to $14.29 an ounce. Copper fell 1.6 percent to $2.78 a pound.
The dollar rose to 113.42 yen from 112.85 yen. The euro fell to $1.1658 from $1.1762.
The FTSE 100 index in Britain rose 0.5 percent, as did France's CAC 40. Germany's DAX gained 0.4 percent. But Italy's FTSE MIB fell 0.6 percent and Italian government bond prices rose as the new government met to discuss its spending plans. Some investors appear concerned Italy will break eurozone budget rules on to satisfy election promises.
Japan's Nikkei 225 dropped 1 percent and South Korea's Kospi, which reopened after a national holiday, added 0.7 percent. Hong Kong's Hang Seng index slipped 0.4 percent.