A federal investigation, combined with a large push into international markets, has caused the world’s biggest retailer to lose ground to Costco in a key market, writes MoneyShow’s Jim Jubak, also of Jubak’s Picks.

Could Wal-Mart’s (WMT) pains be Costco’s (COST) gains? Looks like it in Mexico, at least.

However, faced with a Congressional investigation that has expanded to Brazil, China, India, and South Africa, competition from Costco may be fairly far down the list of worries at Wal-Mart.

Perhaps you’ve been following the unfolding story of $24 million in bribes allegedly paid by Eduardo Castro-Wright, the former CEO of Wal-Mart de Mexico, to “expedite” construction projects in Mexico. An investigation by The New York Times has revealed that top Wal-Mart de Mexico executives had known about the payments and then worked to conceal them from company headquarters in Bentonville, Arkansas.

The timing is probably just a coincidence, but a recent move by Costco looks likely to take advantage of Wal-Mart’s troubles in Mexico.

On June 14, Costco announced that it was buying the remaining 50% of its Mexican operations from Controladora Comercial Mexicana (COMERUBC.MM in Mexico City) for $760 million. This will result in Costco adding about 10 to 12 cents a share to earnings next year, analysts estimate.

Costco has 32 clubs in Mexico now, with $2 billion in revenue. Costco operates 435 clubs in the United States, 82 in Canada, 22 in the United Kingdom, 13 in Japan, eight in Taiwan, seven in Korea, and three in Australia. International operations accounted for 30% of Costco revenue in 2011.

Compare that to Wal-Mart, which has 3,804 units in the United States, 347 units in Africa, 88 in Argentina, 512 in Brazil, 333 in Canada, 622 in Central America, 419 in Japan, 541 in the United Kingdom, and 370 (through joint ventures) in China.

The move to 100% ownership should help Costco close its Mexico gap with Wal-Mart’s Sam’s Club stores by giving the Mexico unit simpler access to financing from Costco. Costco’s club count in Mexico has been stuck at 32 since the end of 2009, while Wal-Mart’s Sam’s Club has growth to 127 club stores from 98 at the end of 2009. Sam’s Club has an 8.4% share of the Mexican market, versus 3.2% for Costco.

But Wal-Mart’s troubles in Mexico and an investigation by the House Committee on Oversight and the House Committee on Energy and Commerce into possible violations of the Foreign Corrupt Practices Act highlights the potential advantages in Costco’s go-slow strategy—not just in Mexico, but in international markets in general.

Wal-Mart now has 4,557 international units—that’s 753 more than in the United States—but all that international expansion hasn’t resulted in the promised big additions to growth. Revenue growth at Wal-Mart has declined from an annual average of 7.35% over the last ten years to an average of 5.09% over the last five years, to an average of just 3.39% over the last three years.

Costco still earns a lower return on invested capital that Wal-Mart—11.25% versus 13.14%—but the gap is as narrow at it’s been in the last few years. Much of that is due to Costco’s ability to ramp sales without building as many stores as Wal-Mart. Costco s now No. 3 in the US market, although it has just 417 US stores to Wal-Mart’s 3,800.

And Costco certainly hasn’t pursued a hot-and-heavy international acquisition strategy like that of Wal-Mart. For example, in November 2010, Wal-Mart bought 50% of Massmart in South Africa (300 units); and in May 2010, Wal-Mart bought Netto Stores in the United Kingdom (193 stores).

I think it’s certainly worth considering that slower is better in the case of these two retailers.

Costco isn’t especially cheap at the moment. The shares closed today at $91.53. My target price comes out to $94, so this isn’t a buy now. But this market does seem likely to produce another dip or two, so keep your eyes open.

Full disclosure: I don’t own shares of any of the companies mentioned in this post in my personal portfolio. The mutual fund I manage, Jubak Global Equity Fund, may or may not now own positions in any stock mentioned in this post. The fund did own shares of Polypore International as of the end of September. For a full list of the stocks in the fund as of the end of September see the fund’s portfolio here.