The results contrasted with those of teen apparel retailer Aeropostale Inc which had to slash prices as ho-hum merchandise failed to find favor with teens during a particularly competitive back-to-school shopping season.

For almost a decade, Gap had struggled with its fashion mix, losing out to rivals such as Zara parent Inditex.

But its main brands have staged a big turnaround in the last year. Banana Republic's tie-in with television show Mad Men was a big success and the chain this week gave popular American designer Narciso Rodriguez an advisory role.

North American sales at its Gap, Banana Republic and Old Navy chains all rose during the quarter, lifting Gap's quarterly profit 28.6 percent. The only blemish on Gap's results were weak numbers in Europe, where same-store sales fell.

Aeropostale, on the other hand, offered too many basics and not enough fashions that teens could only find there, leading to big profit-destroying markdowns of unsold merchandise, Stifel Nicolaus analyst Richard Jaffe said in a research note.

"We believe it is vital that the company improves upon this and grows its fashion offering quickly," Jaffe wrote, noting that the promotional environment in teen retail will last.

Teen employment is at its lowest level since 1964, making more teenagers reliant on their parents to fund their back-to-school shopping. That has led to pricing pressure on items that they can find at any number of stores.

Rival American Eagle Outfitters Inc saw its same-store sales rise 9 percent last quarter, thanks to more compelling fashions, according to analysts.

Aeropostale said it experienced a "soft start" to the back-to-school season, which is crucial to the teen retailers.

"Competitive pricing pressures on our core basic business (have) accelerated into the early back-to-school season, and we believe that both our topline and margins will be under pressure for the remainder of the third quarter," Aeropostale Chief Executive Thomas Johnson told analysts on a conference call.

Aeropostale gave a third-quarter forecast of 25 cents to 30 cents per share that was below Wall Street expectations of 38 cents, according to Thomson Reuters I/B/E/S.

Gap raised its full year profit forecast by 17 cents per share and now expects to earn $1.95 to $2, and also said it now expects its operating margin to be 11 percent, rather than its previously forecast 10 percent.

Gap also managed its inventory carefully so as to avoid fire sales in a tough economy in the event of a pullback by shoppers, helping lift its gross margins 3 points, to 36.9 percent of sales.

For the second quarter ended July 28, Gap Inc earned $243 million, or 49 cents a share, compared with $189 million, or 35 cents last year. Gap Inc sales rose 6 percent to $3.58 billion, while comparable store sales were up 4 percent during the quarter.

Aeropostale reported net income of $71,000, or nil per share, compared to $2.9 million, or 4 cents a year earlier.

Gap shares were up 1.79percent in afterhours trading, while Aeropostale was down 7.5 percent.