U.S. stocks rose Tuesday as investors were relieved to hear Federal Reserve Chairwoman Janet L. 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 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 edged up 24.86 points, or 0.1%, to 17,829.73. The Standard & Poor’s 500 index rose 5.65 points, or 0.3%, to 2,088.90. The Nasdaq composite advanced 6.55 points, or 0.1%, to 4,843.76.

Energy companies climbed despite a decline in the price of oil, which is trading far above the lows it reached early this year. The price of oil rose about 7% over the last two days. Although 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. Earlier this year, it went as low as $26 a barrel.

Benchmark U.S. crude fell 52 cents, or 1.1%, 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 shares rose 1.2% to $78.52 and Occidental Petroleum went up 1.4% to $77.16.

AT&T advanced 0.7% to $41.07 and Verizon rose 0.6% 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 for Britain to stay in the EU in Thursday’s referendum. 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% from 1.69%.


American Science & Engineering, which makes X-ray inspection systems, agreed to be acquired by Hawthorne-based OSI Systems, an airport security and full-body scanner manufacturer. OSI will pay $37 per share, or $263.9 million. American Science & Engineering’s stock jumped 14% to $36.88. OSI shares climbed 9.1% to $57.48.

Used car dealership CarMax disclosed disappointing first-quarter results, saying its costs increased and sales fell short of Wall Street’s estimates. Its stock slumped 4.9%, to $48.14. Auto retailer AutoNation fell 3% to $47.89 and auto supplier BorgWarner skidded 4% to $33.35.

Generic drug maker Impax Laboratories, based in Hayward, Calif., tumbled 11.4% to $28.31 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.

Data security software company Imperva, based in Redwood Shores, Calif., climbed 12.4% to $45.46 after Elliott Capital, the firm run by activist investor Paul Singer, disclosed a stake.


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 fell 9.6% to $22.31.

The price of gold dropped $19.60, or 1.5%, to $1,272.50 an ounce and silver fell 20 cents, or 1.1%, 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% and France’s CAC 40 advanced 0.6%, adding to Monday’s large gains. Britain’s FTSE 100 gained 0.4%. Tokyo’s Nikkei 225 rose 1.3%, Hong Kong’s Hang Seng went up 0.7% and Seoul’s Kospi gained 0.1%.


The dollar rose to 104.76 yen from 103.96 yen. The euro fell to $1.1257 from $1.1314. The British pound edged down to $1.4663 from $1.4693 after a big jump Monday.

MORE FROM BUSINESS

Twitter and Vine loosen limits to hold on to users

Fed’s Yellen says economic growth has been uneven, warranting a cautious approach to interest rate hikes


PG&E to close Diablo Canyon, California’s last nuclear power plant

UPDATES:

4:10 p.m.: This article was updated throughout with additional information.

This article was originally published at 8:08 a.m.