Home Depot Inc raised its fiscal-year profit forecast for the second time in three months as timely promotions and a focus on cheaper products helped the No.1 home improvement chain gain market share from rival Lowe's Cos Inc .

The news, which boosted Home Depot shares 4.7 percent to $32.95 on Tuesday, came a day after Lowe's cut its fiscal-year outlook for the second time in three months, highlighting the widening performance gap between the two.

Home Depot has gained from its recent efforts to improve distribution and customer service. It has been quicker to cut costs than Lowe's, and in some cases has benefited as housing markets have improved in regions where it has a heavy presence. (For a related graphic, click http://r.reuters.com/syc33s)

Same-store sales rose in all but three of its top 40 markets, with particular strength in Midwest and South Atlantic regions, CEO Frank Blake said, adding he was encouraged that soft housing markets like California, Florida, Arizona and Nevada were positive in the quarter.

Home Depot said it still expects fiscal-year sales to rise 2.5 percent. It forecast earnings of $2.34 a share excluding future stock repurchases, up from a prior forecast of $2.24.

They are operating at a high level, taking chances where appropriate in merchandising, leveraging technology investments, and benefiting from a return to more localized marketing and merchandising in the store, said analyst David Strasser of Janney Capital Markets.

In the second quarter, Home Depot's sales at stores open at least a year, rose 4.3 percent globally, including a 3.5 percent rise in U.S. same-store sales, making it the ninth consecutive quarter that it has outshone its smaller rival. Lowe's same-store sales fell 0.3 percent in the quarter.

Same-store sales thus far into August are quite positive, CFO Carol Tome said on a conference call.

Under Chief Executive Frank Blake, Home Depot has upgraded service and products in its core retail business

They knew they were suffering on the customer service front. They really made an effort to turn that around... I think it is really paying off, said Thomas Villalta, a portfolio manager at the Jones Villalta Opportunity Fund in Austin, Texas, which owns Home Depot shares.

Strasser said the 4.3 percent same-store sales rise was better than his 2.5 percent estimate. Promotional programs, including a U.S. Independence Day appliance event and a late July event on storage products, helped win shoppers, he added.

Credit Suisse analyst Gary Balter said that the stock is undervalued and set up for significantly stronger earnings when the housing sector stabilizes.

U.S. housing starts fell less than expected in July, a government report showed on Tuesday.

Still, U.S. homebuilder sentiment remained stuck near historic lows this month and consumer sentiment in the world's largest economy fell to the lowest level in more than three decades in early August.

The US housing market remains under stress, CEO Blake said. We do not expect any meaningful improvement in the housing market for the back half of 2011.

STRONG QUARTER

Home Depot also beat estimates on quarterly profit as demand picked up for seasonal goods after a soft start to the spring selling season. Storm-related repairs also helped.

Its second-quarter net income rose to $1.36 billion, or 86 cents a share, from $1.19 billion, or 72 cents a share, a year earlier. Analysts on average were expecting 83 cents a share, according to Thomson Reuters I/B/E/S.

Sales rose 4.2 percent to $20.23 billion, beating analysts' average estimate of $19.96 billion.

Demand was strong for building materials and outdoor garden products. Home Depot has shifted focus to cheaper products such as faucets and paint to increase shopper traffic.

It reported a 1.1 percent rise in the number of customer transactions in the second quarter, while the average ticket rose 3.3 percent to $54.04.

Sales at home improvement chains have suffered as homeowners have stayed away from bigger renovations and expensive items such as appliances in a weak U.S. economy.

The company, which has bought back $2.3 billion of common shares year to date, is targeting about $1.2 billion of additional share repurchases for the rest of the year.

(Reporting by Dhanya Skariachan; editing by John Wallace, Dave Zimmerman)