Newscasts usually use 'gobyerno' for foreign governments, and 'pamahalaan' for Philippine national government and its local governments.
"Gobyerno ng Tsina," "Gobyerno ng Amerika"
(Chinese government), (American government)
"Pamahalaan, nagbabala laban sa.."
([The national] government warns against..)
"Pamahalaang panlunsod ng Pasig, naglabas ng.."
(City government of Pasig issues..)
The academe favors 'pamahalaan' for both.
Some words have specialized meanings or are exclusive for particular senses.
'Pamilihan' means market in general
'Merkado' means market in the figurative sense.
(There's also 'palengke,' 'tiangge,' and 'talipapa' but those are just subcategories of 'pamilihan')
"Presyo ng bigas sa merkado."
(The price of rice in the market.)
'Kasaysayan' means history and is and has always been preferred over 'historia' even in the Spanish era. 'Istorya' today almost always means like the English 'story.'