Gravina was born in Sicily, at the time a Spanish possession. His father, Juan Gravina y Cruilles, 1st Duke of San Miguel, Grandee of Spain, was Spanish from Catalonia with some Sicilian ancestry, as the Gravinas were part of the Sicilian aristocracy, directly descended from the Normans who conquered the island. His mother was Doña Leonor Nápoli y Monteaporto, daughter of the Prince of Resetena, also a Grandee of Spain. His maternal family originated in Sicily, which was then part of the Kingdom of Naples and ruled by a Spanish Bourbon dynasty. With the help of his uncle, the Neapolitan Ambassador to Spain, he entered the Spanish Navy, as a naval cadet aged 12. He then served as Midshipman on board the frigate "Santa Clara" in Brazil. In the course of this voyage, he carried out his first command when obtaining the surrender of the castle of the Ascensión, located in a small barren island near Santa Catalina. In 1777 he survived a boat accident in the River Plate in which most of the crew drowned. In 1778, on returning to Spain, he served as a lieutenant aboard a ship suppressing Algerian pirates. He then obtained his first command – the polacre-rigged xebec "San Luis" – in which he participated in the Siege of Gibraltar between 1779 and 1782, capturing the British corvette .