Teradyne Inc. (TER) reversed a prior-year third-quarter loss on smaller restructuring charges as automatic-testing-equipment demand continues to rebound.

This is the company's first profit after four straight quarterly losses.

Shares rose 2.2%, to $8.85 in after-hours trading, as the results topped guidance and Teradyne predicted fourth-quarter results generally above Wall Street's expectations. It expects earnings of 12 cents to 17 cents on revenue of $255 million to $270 million, while analysts projected 12 cents and $252 million, respectively. The stock has more than doubled this year.

"Our Semiconductor and Systems Test businesses continued to gain strength through the quarter driving our return to operating profitability and positive outlook for Q4," said President and Chief Executive Mike Bradley.

Many technology companies, particularly semiconductor firms, have reported brightening prospects. In the current quarter, Teradyne was expected to end temporary salary cuts enacted last year as slack consumer-electronics demand rippled up the supply chain.

Teradyne reported a profit of $6.7 million, or 4 cents a share, compared with a year-earlier loss of $22.7 million, or 13 cents a share.

The latest period included restructuring charges of $5.2 million, compared with $28.6 million in the prior-year quarter. Excluding items, earnings were 14 cents a share.

Revenue decreased 12%, to $262.2 million.

The company early this month boosted its already robust forecast to earnings of 10 cents to 13 cents on revenue of $250 million to $260 million.

Gross margin fell to 40.7% from %43.

Bookings climbed 46% to $288 million from a year earlier and 27% from the second quarter.

-By Tess Stynes and Kathy Shwiff, Dow Jones Newswires; 212-416-2357; Tess.Stynes@dowjones.com;