First of all, the Spanish (along with the rest of the large European countries at the time) had guns and other military technology. With the advantage of having gunpowder, the Spanish were able to relatively easily conquer the indigenous peoples in the Americas. Another point is the Spanish military training; the American civilizations had no military training that matched the strict codes of the European countries, so the precision of the Spanish helped them conquer.
america declared war on japan and joined the allies
This is true. Another reason the Colonists went to war was because of the Injustices that had been done to Colonists by the English.
Nationalism is a political principle or ideology that aims to unify the whole nation through the value of patriotism, in which each member should value the products produced by its nation, use its distinct language and never accept anything outside their sovereignty. This idea is accompanied by the belief that a certain country is far better than other countries, therefore there's a hidden idea of superiority.
Although pride for one's nation is good; however, this principle led to discontent in the empires of the 19th and early 20th centuries due to the fact that this ideology bred the idea of racism and fascism. These ideas gave a negative impact on humanity.
The Nazi regime (1933-1945) under the dictatorship of Adolf Hitler controlled almost all the aspects of life not just to the Germans but to other races as well. This regime caused the holocaust of the early 20th century where millions of Jews and other people were killed for they were viewed as undesirable. Racism is actually the central feature of Nazi regime where Hitler viewed his country and people as the master of race and the superior of all.
The fascist government run by Benito Mussolini in Italy (1922-1943) is another example of nationalism. Fascism deals more on the economy of the country in which the government controls the private sector's factors of production, it's labor, capital goods, and natural resources. This type of government lured the masses by letting them believe that this control would give them general welfare to achieve their goals. Since the mass of people has been included, the private sector could no longer do anything to fight against the government mandated system.
Both these two systems of governance use the idea of nationalism to override self-interests. They manipulate the mass of people to take control.
The idea of nationalism is naturally good, but the desires of men changed its purpose. It should ideally be applicable to those leaders who value humanity more than himself for this ideology breeds selfishness in the desire for power.
Japan's nationalism over their technologies remains successful until these days because they serve the ideal purpose of nationalism, to love its own country by means of being patriotic.