I realize that if Spain does take Tonkin to expand its empire some interesting ethnic migrations would occur as they are part of Spain during that time.
Though when the Spanish-American War arrives, its going to be interesting if the United States also takes control of Tonkin. (Butterflies butterflies)
Though I do hope someone with a knowledge of Vietnamese history would respond to this.
Let's go with this a bit- The Spanish go for Tonkin in the 1858-1863 era, and win. (keep in mind they have the possibility of losing too) I wonder where the divide between the French and Spanish spheres would be, north or south of Danang.
The Spanish will need to bring in more reinforcements than just the several hundred Filipino troops they employed in OTL to secure Haiphong or Hanoi.
Might that make them hesitant to intervene in Mexico or the Dominican Republic (or the war of the Pacific, versus Peru and Chile) later?
Can Spain keep up the colonial enterprise when its throne goes vacant and they have the instability of the 1870s?
I think at this time (1850s & 1860s) with China wrapping up the Taiping rebellion, China would not be a factor.
So, assuming a Spanish occupied northern Vietnam, yes there is some opportunity for Filipino and Vietnamese cultural blending. Different portions of Vietnam are exposed to different European cultures.
As for what happens when and if there is a Spanish-American War, I think that US annexation of Vietnam, a mainland territory, would be much more controversial than the Philippines, and probably not approved. But that does not mean there would not be military action. There may be Spanish navy in Haiphong that Admiral Dewey feels compelled to chase down. Since the Americans didn't have alot of ground forces, they probably would try to work with rebels against the Spanish. The Chinese or Japanese might be patronizing rebels as well. Creates quite a different situation from OTL.
If miracle or miracles northern Vietnam is held by Spain, then that changes things quite a bit if there is ever a WWII analogue. I don't see a special reason why Spain would not opt for neutrality as it did for OTL's big European wars.
Plan B-
Other options include the Spanish trying, and failing, to conquer in northern Vietnam. That could lead to them quitting and maybe the French coming in anyway, converging with OTL.
Or, the Spanish could get established, but after the Taiping rebellion is defeated, the Black Flag and Chinese imperial armies may conflict as Spain tries to further tighten its grip and deny Chinese prerogatives in the 1870s or 1880s. The Chinese probably think they have better odds against Spain than France, and, since they gave the French a run for their money at first, they might succeed in outright defeating the Spanish and driving them out of Vietnam. If we really want to go nuts we could have the Chinese and Japanese both fight the Spanish, with the Chinese taking northern Vietnam, and the Japanese the Philippines.