"It was a nice bounce-back from a weak August," said Mitchell Kaiser, a retail analyst at Piper Jaffray, adding that Costco continues to take market share as consumers consolidate shopping trips.
"They're certainly a destination, and you can go there, it can be a one-stop shop, and you get great value at a very reasonable price," he said. "That resonates with consumers."
The company said net income rose to $372.4 million, or 83 cents per share, in the fiscal fourth quarter ended on Sept. 2, from $355.6 million, or 75 cents per share, a year earlier.
Excluding a one-time charge of 8 cents a share related to how it recognizes membership fees, earnings per share were 91 cents.
Analysts, on average, had been expecting 83 cents per share, according to Reuters Estimates.
Charles Grom, a retail analyst with JP Morgan, said Costco delivered its best quarterly gross profit margin performance in five years, "driving significant, high-quality earnings-per-share outperformance."
Earlier this year, the retailer implemented a new 90-day return policy on consumer electronics to cut down on customers returning old items after purchasing newer models. Analysts said the move is helping to improve Costco's margins.
Investors are watching retail sales closely to see how consumer spending holds up headed into the crucial holiday selling season.
Late last month, Target, the No. 2 U.S. discount retail chain behind Wal-Mart, cut its September sales forecast. Children's Place Retail Stores slashed its third-quarter earnings forecast on Tuesday, saying price cuts hurt its margins.
Most major U.S. retail chains will report their September sales figures Oct. 11.
Costco said its sales at stores open at least a year, or same-store sales, rose 5 percent during the fourth quarter compared with a year earlier.
For September, total sales at its clubs open at least a year rose 6 percent. Analysts on average were expecting a 4.7 percent increase, according to Reuters Estimates.
Its September international same-store sales jumped 13 percent, while U.S. same-store sales increased 4 percent in the month.
Third-quarter net sales rose to $20.09 billion from $19.5 billion a year earlier. Including membership fees, revenue was $20.5 billion.
Costco customers pay an annual membership fee to shop at the retailer's stores, which sell everything from toilet paper to diamond rings.
Costco operates 520 warehouse club stores, including 385 in the United States and Puerto Rico.