Spock may be counting just the Allied deaths.
Spock's figure for WW 1 is
close to the number for allied military deaths of 5.7 million.
It's possible that Spock was simply wrong in the figures that he recited, he's not infallible. And that neither Kirk nor McCoy choose to correct him at that time, assuming that either of them knew off hand the correct figures.
It was later established that 600 million died in the Trek 3rd world war, and the 37 million dead could have been for the eugenics war. Spock confused the eugenic war with the 3rd world war once before in Space Seed, and might have been repeating the mistake.