NEW YORK — Coffee chain Starbucks Corp., which is closing stores and cutting office jobs amid weak sales in the U.S., posted a loss for its third quarter on Wednesday, lowered its outlook for the year and said it would open fewer new locations.

NEW YORK — Coffee chain Starbucks Corp., which is closing stores and cutting office jobs amid weak sales in the U.S., posted a loss for its third quarter on Wednesday, lowered its outlook for the year and said it would open fewer new locations.

But the company kept its profit guidance intact for fiscal 2009, easing investors' fears about the year ahead.

"I don't think anyone's really focused on the quarter," said Edward Jones analyst Jack Russo. "Everyone is thinking of next year."

Starbucks shares rose 70 cents, or 4.8 percent, to $15.37 in electronic after-hours trading. During regular trading they had fallen 2 percent.

The Seattle-based company reported a loss of $6.7 million, or 1 cent per share, compared to a profit of $158.3 million, or 21 cents per share, a year earlier. Starbucks said it earned 16 cents per share once the costs for restructuring and closing stores are excluded.

Analysts polled by Thomson Financial expected a profit of 18 cents per share on revenue of $2.61 billion.

Starbucks said revenue rose 9 percent to $2.57 billion from $2.36 billion, mainly from sales at international locations and new stores in the U.S. Same-store sales, or sales at stores open for at least a year, fell in the mid-single-digits in the United States.

That decline offset a lift in brewed coffee sales from the launch of its Pike Place roast, and was what Starbucks called a "slight deceleration" from the second quarter, when it also reported a "mid-single-digit" drop in U.S. same-store sales.

Starbucks, which said earlier this year that it would close 600 underperforming stores in the U.S., announced this week that it was also shutting 61 stores in Australia and cutting 1,000 office jobs — including 450 unfilled positions — to reduce costs.

The chain said Wednesday that it will open fewer U.S. and international locations in 2008. For 2009, Starbucks said it will open 165 new stores in the U.S. but will also close 225 locations. Internationally, the company said it will open about 900 new stores in 2009.