While the Spanish built a huge colonial empire in the Americas, why didn't Portugal colonize the South Asian coast and only aimed at controlling trade?
Why did these empires pursue such different strategies?
After the voyages of Columbus, who sailed for Spain, the Portuguese and Spanish divided up the new world in the Treaty of Tordesillas (1494). The later pattern of colonization followed this treaty in general outline.
Your question has an incorrect assumption, that the Portuguese were only traders. They had a global empire that included Brazil, islands in the Caribbean, the Azores, many places in Africa, India and Southeast Asia.
Spain and Portugal controlled their colonies differently because they developed differently during the 15th century.
By the 15th century, Portugal was already a "complete" country. The century was characterized by seagoing voyages under Prince Henry the Navigator, around the coast of Africa. The end result was Vasco da Gama's sailing totally around Africa, all the way to India. It was too hard for the Portuguese to "project power" over such a long distance, and further, to modern Indonesia, so they preferred to operate by "proxy," via trading posts.
Spain spent the 15th century driving out the Moors from Granada, subjugating it in an overland attack. After they finished, in 1492, Columbus discovered a large, and sparsely populated continent far to the west. But apart from the "small" matter of a few months of sailing, conquering the (American) "Indians" was a task well-suited to men who have just finished conquering the Moors, which is why the Spanish used such a "top down" approach to governing their empire.