NEW YORK (AP) -- U.S. stocks rose Tuesday as investors were relieved to hear Federal Reserve Chair Janet Yellen say the Fed would remain cautious in raising interest rates.
Stocks hardly budged for most of the day as investors were occupied by Yellen's Congressional appearance and the looming vote on Britain's possible withdrawal from the European Union.
Energy and phone companies made the biggest gains. For the second day in a row, stocks traded higher and bond prices fell as investors felt a bit surer that Britain will stay in the EU.
Yellen told the Senate that the Fed will proceed cautiously in raising interest rates because of the uncertainties facing the U.S. economy. She said the central bank will watch carefully to see if the recent slowdown in job growth is temporary or a sign of a bigger problem. The Fed left interest rates unchanged in June and will meet again in late July. Yellen's testimony will conclude on Wednesday.
"The market seems to have responded well to Dr. Yellen's tone of caution," said Phil Orlando, chief equity strategist for Federated Investors.
The Dow Jones industrial average picked up 24.86 points, or 0.1 percent, to 17,829.73. The Standard & Poor's 500 index rose 5.65 points, or 0.3 percent, to 2,088.90. The Nasdaq composite added 6.55 points, or 0.1 percent, to 4,843.76.
Energy companies climbed despite a dip in the price of oil, which is trading far above its lows from early this year. The price of oil rose about 7 percent over the last two days. While Orlando expects the price of oil to decline further, he said oil companies will still be able to make money if oil trades between $40 and $60 a barrel. That wasn't the case earlier this year, when it went as low as $26 a barrel.
Benchmark U.S. crude fell 52 cents, or 1.1 percent, to $48.85 a barrel in New York. Brent crude, the benchmark for international oil prices, slipped 3 cents to $50.62 a barrel in London.
Schlumberger gained 93 cents, or 1.2 percent, to $78.52 and Occidental Petroleum picked up $1.06, or 1.4 percent, to $77.16.
AT&T added 29 cents to $41.07 and Verizon gained 34 cents to $54.10 as phone companies made some of the biggest gains.
Opinion polls and betting markets indicate that Britons are more likely to vote to remain in the EU in a referendum Thursday. But polls suggest the vote will be close, and uncertainty about the outcome has weighed on global markets and contributed to a recent five-day losing streak for U.S. stocks.
On Tuesday bond prices fell as investors felt comfortable taking on riskier investments. The yield on the 10-year U.S. Treasury note edged up to 1.70 percent from 1.69 percent.
Used car dealership CarMax disclosed disappointing first-quarter results as its costs increased and sales fell short of Wall Street's estimates. Its stock gave up $2.49, or 4.9 percent, to $48.14. Auto retailer AutoNation fell $1.47, or 3 percent, to $47.89 and auto supplier BorgWarner skidded $1.38, or 4 percent, to $33.35.
Transportation and logistics company Werner Enterprises forecast disappointing second-quarter results. It said sluggish freight market conditions are hurting rates, as are the costs associated with an increase in pay for drivers. The stock lost $2.37, or 9.6 percent, to $22.31.
American Science & Engineering, which makes X-ray inspection systems, agreed to be acquired by airport security and full-body scanner manufacturer OSI Systems. OSI will pay $37 per share, or $263.9 million. American Science & Engineering's stock jumped $4.54, or 14 percent, to $36.88.
Generic drug maker Impax Laboratories tumbled after it agreed to pay $586 million for a group of generic drugs owned by Allergan and Teva Pharmaceutical Industries. Those companies had to sell the products because Allergan is buying Teva's generic drugs business. Impax lost $3.66, or 11.4 percent, to $28.31.
Data security software company Imperva climbed $5.02, or 12.4 percent, to $45.46 after Elliott Capital, the firm run by activist investor Paul Singer, disclosed a stake.
The price of gold dropped $19.60, or 1.5 percent, to $1,272.50 an ounce and silver fell 20 cents, or 1.1 percent, to $17.32 an ounce. Copper rose 2 cents to $2.12 a pound.
In other energy trading, wholesale gasoline rose 1 cent to $1.59 a gallon. Heating oil slipped 1 cent to $1.52 a gallon. Natural gas rose 2 cents to $2.77 per 1,000 cubic feet.
Germany's DAX rose 0.5 percent and France's CAC 40 advanced 0.6 percent, also adding to large gains on Monday. Britain's FTSE 100 gained 0.4 percent. Tokyo's Nikkei 225 rose 1.3 percent and Hong Kong's Hang Seng added 0.7 percent while Seoul's Kospi gained 0.1 percent.
The dollar rose to 104.76 yen from 103.96 yen. The euro fell to $1.1257 from $1.1314. The British pound edged back down to $1.4663 from $1.4693 after a big jump Monday.