MEXICO CITY—The world’s largest oil companies won rights to develop Mexico’s offshore oil deposits in an auction that led to twice as many awards as officials expected and could generate $40 billion in investment.

Eight of the 10 exploration blocks available were snatched up in competitive bidding by firms including Exxon Mobil Corp., Chevron Corp., and China’s state-run China National Offshore Oil Corp.

Australia’s...