I think the problem is that you assume that all Latinos have Spanish ancestry or identify as "Spanish". Also, as a Latino living in the US, I can personally attest that most census categories actually do not differentiate Hispanic/Latino and "white"- after selecting "Latino", you are then asked which "race" you identify as (a contentious issue for Mestizos who do not see themselves as fitting neatly into the US' black/white binary). There are obviously Latinis who do identify as "Spanish"/ white, and from what I can tell, "Spanish" Latinos like Ted Cruz or Cameron Diaz often are regarded as "white" in the US (assuming they are of high socioeconomic status), though it should also be noted that "whiteness" in the United States is a complicated construct with an equally complicated history. If we see "race" as a social construct and apply that to a country with a history of apartheid and, for much of its history, an overtly systemic racial caste system, we can see that "whiteness" in the US is more about acceptance within the dominant caste than simply just skin color.
Take, for example, Takao Ozawa, a Japanese American who, in 1922, lost his Supreme Court case for naturalization. https://www.law.cornell.edu/supremecourt/text/260/178 Under US law, one had to be "white" to become a naturalized citizen, and Ozawa attempted to prove, based on his complexion, that he was "white". He lost his Supreme Court case, however in 1915, a Syrian immigrant named George Dow won his case when the Supreme Court determibed Syrians were "white" https://cite.case.law/f/226/145/.
There are various examples of American perspectives on southern and eastern european immigrants in the late 19th century as well which suggests "whiteness" has always been a subject of inclusion/ exclusion in the United States, and always placed within the context of "blackness" (those explicitly excluded, or initially enslaved, under Anerican apartheid). The topic of race in the US is one I could go on about for a very long time, discussing the formation of the "model minority" myth with regards to Asian Americans as a contrast to blacks and latinos, for example, but to avoid spending five hours researching/ writing, and getting seriously off topic, I'll loop back around to Latinos in the hopes that you have a base level understanding of race relations in the United States by this point.
Latin America is a diverse place, and to categorize the people who live there or trace their ancestry there as "Spanish" because they often speak Spanish is an overgeneralization at best, in many cases it's just plain wrong. Sure, in places like Argentina, for example, you might find a large percentage of the population claiming European ancestry, but for much of Latin America you have people who are "mixed" or even full blooded Native American or Afro-Latino. Calling someone of African descent from Puerto Rico, Dominican Republic, or Venezuela; or someone of Native descent from Guatemala or Mexico; "Spanish", sort of dismisses their heritage and imposes upon them the culture, history, and even ethnicity of their former colonial overlords/ oppressors. I know this wasn't your intent as you seem genuinely ignorant of the diversity within Latin America, but it's worth pointing out so as to avoid making these kinds of reductive assumptions.
Back to the US though. For American ethno-nationalists, they often make the opposite assumption that you've made. For them, most Latinos are not white Spaniards, and even if they were, their class/ immigrant status amid nationalistic xenophobia means for poorer Latinos, especially if they are immigrants, they most likely will not be regarded as "white", even if they are of a light complexion. At this point we can get into a deep and complex discussion on nationalism and how it inherently "others" people separated by borders defined by the nation-state, or those who do not fit neatly into the norms of the dominant ethno-nationalistic group within a nation-state, but for brevity's sake I'll leave assessments on that for replies (assuming this doesn't get deleted for not being historical).
My degree is in Sociology btw, not history (though I obviously have an interest, hence my following this sub). As a Latino in the US who studied Sociology in College, I spent a lot of time reading about race in the US. The sources I cited were quick google searches on the Supreme Court cases, and I tried to use websites that looked academic, though the cases are all on Wikipedia, and I'm sure plenty of Academic Journals if I wanted to log in to EbscoHost or something. Most of the information was either things I remembered from school or things I've experienced first hand. Hopefully this is detailed enough to stay up here, I feel like most of what I said could be easily backed up with journal articles if that were necessary.
This is (unsurprisingly) part of America's complicated, and frequently bloody, history of race. Everything that follows is going to be deeply unpleasant, so be warned.
Up until the start of the 20th century, Americans used the word "race" fairly similar to Europeans: people would talk quite un-selfconsciously about "the British Race," "the Jewish Race," and so on. During the mid-19th century, race theory became a singular obsession in the US, largely as part of attempts to justify slavery; this led to the concept of the "Black Race" emerging. (Among white writers, that is) One of the important outcomes of this was a transition from a purely chattel notion of slavery (you are a slave because you have that legal status, and so will all your descendants unless they are freed) to a more abstract notion of who "should" be a slave (you are a slave because you come from an inferior race, and so it is for your benefit that we have enslaved you). This idea increasingly influenced both political and legal thinking, with the Dred Scott decision (US Supreme Court, 1857) being its pre-Civil War peak: it ruled, inter alia, that
We think ... that [black people] are not included, and were not intended to be included, under the word "citizens" in the Constitution, and can therefore claim none of the rights and privileges which that instrument provides for and secures to citizens of the United States. On the contrary, they were at that time [of America's founding] considered as a subordinate and inferior class of beings who had been subjugated by the dominant race, and, whether emancipated or not, yet remained subject to their authority, and had no rights or privileges but such as those who held the power and the Government might choose to grant them. — Dred Scott, 60 U.S. at 404–05.
The American Civil War (1861-5 officially, in practice 1861-1877) is often portrayed as ending slavery in the US, but a more accurate description might be that it changed how slavery worked. The resulting 13th Amendment to the US Constitution says that
Neither slavery nor involuntary servitude, except as a punishment for crime whereof the party shall have been duly convicted, shall exist within the United States, or any place subject to their jurisdiction.
The "except" clause was very much not unintentional, and became the foundation for how slavery was reconstituted after the war.[1] One of the defining features of the postwar slave system, especially in the North, was that the racialization of the justification of slavery became even more intense: the old "slavery is good because Blacks are lesser creatures that need to be cultivated for their own good" turned into "slavery is good because Blacks are inherently violent and criminal, and need to be controlled for the public good."
Isn't this just lovely? It gets worse.
This system spent the period from 1870-1910 in flux, until finally in the early 1910's it started to coalesce into the (in)famous Jim Crow system, which took these informal racial ideas and wrote them much more explicitly into law. There were a lot of really important things going on in this period (the foundation of the second version of the KKK, the writing of a lot of texts and films that really shaped American racism for the next century, etc), but for the purpose of your question, one of the significant factors was a change in the meaning of the word "race."
As I mentioned earlier, up until this point, Americans used the word "race" in more or less the same way as Europeans did. In order to reify race laws in the 1910's, however, it became necessary to explicitly (and legally) define each person's race -- which was initially defined as "who is White and who is Black." This led to some very interesting contests around marginal groups, and some offers that were "extended" to these groups (in the sense of "an offer you can't refuse") in very public ways, which were vividly captured in the press of the time. The Irish and the Jews were two groups that were interestingly marginal in this case: both were considered clearly separate races prior to the 1910's, and during the 1910's were essentially offered the choice of which side they were going to be on. In the Jewish case, with which I'm more familiar, the deal basically boiled down to: Option 1: You can be White. The price for this will include your full-voiced support for the system of white supremacy; your commitment to an idea of a "Judeo-Christian Society" (a term which hadn't existed prior to this point), which essentially means that you should add your imprimatur to the legitimacy of Protestantism, and actively make yourselves as similar to Protestants as possible; and a (violent if you have to) rejection of any suggestion of Europeanism or especially Socialism. Option 2: You can be Black. If you are not clear on the price for this, let us demonstrate. (There followed a number of lynchings of Jews; the Anti-Defamation League was founded in response to this)
Unsurprisingly, most people chose option 1. [2] Perhaps even less surprisingly, a lot of people chose option 3, which was to move way the hell away from these kinds of conversations; this is the origin of the large Jewish population of Los Angeles, which at the time was effectively very far away from everyone else.
But this was also a time period when the American West was becoming a much larger part of US society: between 1900 and 1930, Los Angeles grew from 100,000 people to over 1.3 million. There were two substantial population groups which were significant in the West who weren't in the East: Asian immigrants, mostly Chinese immigrants who had come during the late 19th century to work on the railroads, and Mexican immigrants, who became a major immigrant group in California starting in the 1910's. [3] These groups weren't worked into the New Slavery system that was focused on Blackness, but clearly couldn't be considered White either. (I mean, that would be shocking) Likewise, there was the "Indian Question," i.e. what to do with the population of Native Americans who had survived the active genocide projects of the 18th and 19th centuries. [4]
The net result of this is that the US came to legally define a new concept of "race," which you can see in how the U.S. Census race categories evolved. By the end of the 1910's, the major categories had stabilized: you could be Black, Native American, Latino, Asian, or (if your blood was pure) White.
This is why we ended up with these rather weird categories that don't obviously harmonize with each other. They have nothing to do with an attempt to classify people ethnically; they have to do with which legal category you were supposed to be in. The real meaning of these was basically Black (you are prone to violence and should be imprisoned and enslaved), Native American (you are idle and drunk and should be left to die), Latino (you are an immigrant farm laborer and should be exploited), Asian (you are one of those untrustworthy extreme foreigners and should be legally isolated from everyone else), or White (you are a Real American, congratulations).
I wish there was any answer to this that was less disgusting, but I'm sad to say that the more you dig into this, the worse it all gets.
In fact, you know who was really interested in digging into this, and wanted to understand the American model of using race to manage slave labor and industrialization better? German industrialists in the 1910's through 1930's. See James Whitman's Hitler's American Model: The United States and the Making of Nazi Race Law.
And with that cheerful little note, I leave you, and am going to go try to wash my brain out with soap.