Duck You Sucker
(aka A Fistful of Dynamite)

James Coburn aka "John"and Rod Steiger aka "Juan" start out on the wrong foot but they end up good friends and fight in the revolution together.

Juan eventually kills Governor Jaime, the leader of the Mexican government and James Coburn ends up blowing himself up with dynamite after being critically wonded by three bullets in the back

Thanks Ed L!