He became King on 25 July 1139 , after winning the Battle of Ourique . Afonso took the title of King of the Portuguese on 25 July 1139 , immediately after the Battle of Ourique , acclaimed by his army , and died on 6 December 1185 in Coimbra .