How was Portugal, a small, relatively poor country able to project its power so effectively into the Indian Ocean in the early 16th century?

by Khwarezm

I've never really understood how Portugal was able to, among other things, repeatedly come out of battles in the Indian Ocean victorious, and gain strategically crucial footholds in the Indian Ocean.

They were a relatively small country that didn't have a particularly notable military history before this, fighting halfway across the globe with lines of communication that would have meant it could take years to build up and reinforce forces, travelling through some very dangerous waters into an ocean they weren't previously familiar with. How was it at all possible that they were not only able to fight toe-to-toe with powers like Gujarat and the Ottomans, on their own turf with much shorter lines of communication, but win and seize territory? Shouldn't their enemies have been easily able to overpower and expel them?

terminus-trantor