In 1862 he became major general, and in November of that year was made military governor and commander-in-chief of the province of Santiago de Cuba. The insurrection against the Spanish domination of Santo Domingo, which had been annexed in 1861, began in the department of Cibao in February 1863; the troops were soon driven into the coast-towns, and the interior cities wrested from them. Gandara, without waiting for orders from the home-government, despatched reinforcements to his comrades by the frigate "Isabel II", then in port. He afterward received orders to march with all the forces at his command to the assistance of the commander-in-chief. He landed in Puerto Plata, 17 September 1863, driving the insurgent forces back, and afterward occupied the cities of Santo Domingo and San Cristóbal, the latter after a series of bloody engagements with the enemy, in 1864 he was promoted to lieutenant-general and appointed captain-general and commander-in-chief of the island, and in that year won the battle of Monte Cristi. The provisional government now began peace negotiations, which, however, led to no favorable issue. Meanwhile, the home government resolved to abandon the struggle, and in May 1865, Gandara, with his troops, evacuated the island.