Most European sightseeing tickets do not need to be purchased before leaving home. Buying early will not usually save money. However, there are some individual sights that are so popular that showing up without a ticket is quite likely to consign you to a long wait in a ticket line. If you show up at something like 3 PM, you might find the place sold out for the day by the time you get to the ticket booth. That's less likely to happen in December than in July, but there is a risk.
If you tell us what places you want to visit, we can (collectively) probably warn you about any you should be concerned about.
Are you going to Barcelona? It has a bunch of problem sights:
- La Sagrada Familia
- Parc Guell
- Casa Mila/La Pedrera
- Casa Batllo
- Picasso Museum
- Palau de la Musica Catalana (the issue here being the English-language tours)
I would buy those tickets in advance to avoid the ticket lines, but that doesn't mean now. It's quite possible you could wait until you're sitting at the US airport waiting to board your flight (but I'm not promising that). Those are not places that sell out months in advance. It helps if you have flexibility about the time of day for which you need tickets. The first time slots in the morning seem to be the most popular. If you're trying to cram three days' worth of sightseeing into two days, that's like putting together a jigsaw puzzle, and getting the tickets you need could be harder. If you get stuck having to take a tour because all the plan-vanilla tickets are sold out, that's when it will cost you extra money.
Are you going to Granada? The Alhambra does sometimes sell out for weeks in advance. That's a ticket you'll need to buy well ahead of time. As of today there are no tickets available until November 2, and the ticket calendar shows only "last tickets" available for November 2-8, 10-15, 19 and 27. There are already five days in December with only "last tickets" available. The thing about "last tickets" is that it can mean the only tickets available are for very late in the afternoon, meaning a possibly-rushed visit to the Nasrid Palaces (the area you cannot enter before your ticket time). If you click on a date, the website will show you how many tickets remain available for each time block. That will allow you to monitor the situation for the day(s) you'll be in Granada so you know when you need to go ahead and buy your tickets. The basic Alhambra ticket costs just under 15 euros per adult (one of the world's great sightseeing bargains), so it's not a huge amount of money to have at risk.
https://tickets.alhambra-patronato.es/en/producto/alhambra-general/
Are you going to Seville? The ticket lines for the cathedral and the Alcazar are annoyingly long. Tickets don't sell out early as far as I know, but you should buy the tickets before you arrive at those sites.
This is not intended to be a list of all the places in Spain where it would be smart to buy tickets at least a bit in advance; it's just the places where I, personally, bought tickets in advance.
I haven't been to Portugal for decades and am not up on what the tricky tickets might be for that country.