An offshore magnitude 7.8 earthquake rocked the southern Philippines, killing at least 12 and sparking a 3-foot tsunami along nearby coasts, officials said.