Henraques consolidated his position by defeating the Moors at the Battle of Ourique in 1139 , and celebrated by naming himself the first king of Portugal .
Henraques faced fierce opposition when he appointed himself king .