Ser for identity, origin, nationality, profession, time and inherent traits: Sou brasileiro. São quatro horas.
Estar for current states, emotions, and (in most varieties) location: Estou cansado. O livro está na mesa.
European Portuguese also commonly uses ser for permanent location of buildings/cities.