From a public relations standpoint, the second quarter of 2014 was one of the worst in the history of General Motors. But those negative headlines did little to scare off auto buyers in the U.S. or around the world, as the automaker sold 2.5 million vehicles globally during the period.
The automaker's two largest markets, China and the U.S., drove the company's results. Sales in China climbed 8 percent, while the U.S. saw sales rise 7 percent compared to the same period in 2013. Worldwide, the automaker's sales edged higher by 0.5 percent.
Read MoreGM kept silent on fatal crashes
In the first half of the year, the country's largest automaker sold 4.92 million vehicles worldwide, and it's on pace to sell nearly 10 million vehicles globally in 2014.
The strong sales report comes as CEO Mary Barra and GM's top attorney, Michael Millikin, prepare to testify on Capitol Hill about how the company handled cases involving defective ignition switches.
Those switches are linked to the recall of 2.6 million cars and more than 50 accidents that killed at least 13 people.
Since mid-February, GM's ignition switch crisis has been big news in the U.S. and, to a lesser extent, around the world. Still, sales have not slowed.
GM's struggling Cadillac brand saw sales improve during the second quarter, led by a 51 percent surge in China. The results helped offset a sluggish year for the luxury brand, which last week hired Infiniti's Johan de Nysschen as its new president.
Read MoreRecalls aren't stalling GM's sales
"We are investing in our brands around the world to keep our momentum going, and that includes growing Cadillac in China," Barra said.
The biggest brand at General Motors, Chevrolet, also posted record sales in China during the first half of the year.
Strength in the world's two largest auto markets helped GM offset struggles in South America, parts of Asia and Eastern Europe. The company did not release the change in sales for those regions.
—By CNBC's Phil LeBeau.
Questions? Comments? BehindTheWheel@cnbc.com.
CORRECTION: General Motors' global sales came close to hitting a new record in the second quarter.