Having Amadeo refuse wouldn't really work IMHO. If I remember right Prim was actually going after a member of the Hohenzollern, the aforementioned Leopold. But it was being done in secret, and after word of it got out the entire thing fell apart, the Franco-Prussian War ensued, and they went with Amadeo.
The key is that things weren't being run by a Junta, but rather the Cortes, and I think it was Payne's History of Spain and Portugal that said that the vote to elect Amadeo was only passed by a single vote. Of course if the vote fails, and they can't find another candidate, my personal guess would be that factionalism still devours the Republic and a restoration ensues.
The best path IMHO is to start with keeping the Cuban situation from escalating out of control. Have the concilitory efforts on the part of Prim succeed, lower taxes, or some such. I'm not sure how plausible it would be, given how entrenched the Españolista were, but anything you can do to keep Cuba from boiling over helps.
If you can do that, you can lower the military draft and kneecap the earlier Federal Republicans and stop them from gaining the support needed for the insurrection in 69' from happening on such a large scale. This keeps Prim more popular, which in turn hopefully helps keep things more stable and less factional during the search for a new King. Leopold is still unlikely to end up on the throne, but you might be able to butterfly away the circumstances that allowed for the Franco-Prussian War. Amadeo is still on the table, and can possibly be elected by a wider margin , but I'd actually go with Antoine, Isabel's Brother-in-Law, who was a candidate for the throne. He'd actually been in Spain and supported the Revolution. He
might draw off some of the Carlist supporters, and conservatives like Canovas, but I don't really know.
Odds are strong there's still some form of uprising and unhappiness with the new government, but with the extra stability, and lack of a Cuban crisis, it's easier to stop. At this point, Spain's in a better position but isn't actually a Republic. Butterflies will also prevent some of the more boneheaded choices (like putting Quintana in charge of...anything really) from taking place which should also help things.
At this point, Spain's a Constitutional Monarchy rather than a Republic, but you have a level of stability and the butterflies from that alone are going to be enormous. You can easily work in a more gradual move towards a Republic. More gradual doesn't necessarily mean more peaceful in this case however, tensions will certainly continue to exist between the various factions of the government, and could erupt violently if that's where you want the butterflies to go in order to transition to a Republic. Cuba could likewise still be simmering and boil over into war, Morocco could revolt, and so on. The post-Revolution is one of those periods of time where there's a lot of potential for things to develop differently over the course of the next few decades, but it's unlikely to end in a Republic, if only because the Republic faction at the time is small, and by the time the Republic itself is actually declared there are a lot of different problems that are throwing things into chaos that would make it hard for the Republic government to survive. It's possible that it does, as more of a dictatorship judging by how things were going towards the end.
The best way to accomplish that would probably be to have Canovas's ship to England sink, Alfonso is thrown off a horse and breaks his neck, and...something something his sisters don't the support/age and the entire thing turns into Carlism of a different shade.
IDK, it's 2 AM here