General Motors has reported strong earnings growth for the second quarter and cited record margins in North America as a key driver.