DNI, passport or drivers license. All of these IDs cost money. DNI is compulsory after 16.
The US doesn't require citizens to have an ID just to exist. That's part of the "freedom" Americans like to talk about. It sounds like every citizen in Spain already has a DNI so they should be able to vote without additional hassle.
It's the additional hassle to vote that opponents of voter ID laws cite as the crux of the issue. If you pair mandatory voter ID laws with strategic ID office closures (among other barriers), you can influence who can vote. This has already happened; it isn't hypothetical.