Álava joined the Spanish navy in 1766. In his early years, he was involved in fighting the pirates of the North African coast (whom the Spanish navy had been fighting for a long time). In 1781, he commanded the corvette "San Luis", which took part in the Spanish blockade of Gibraltar during the American Revolutionary War. He took part in an attack on the floating batteries of Gibraltar, and was involved in the Battle of Cape Spartel on 20 October 1782. Shortly after, he was promoted to "capitán de navío" (naval captain), and was transferred to the frigate "Sabina".