Gómez was born in the town of Baní, in the province of Peravia, in the Dominican Republic (then a part of the Republic of Haiti, while Hispaniola was unified). During his teenage years, he joined in the battles against the frequent Haitian incursions of Faustin Soulouque in the 1850s. He was later trained as an officer of the Spanish Army at the Zaragoza Military Academy in Spain. He had arrived originally in Cuba as a cavalry officer, a captain, in the Spanish Army and fought alongside the Spanish forces in the Dominican Annexation War (1861–1865), earning promotion from captain to commander in a famous victory over the Dominican general, Pedro Florentino.