MEDINACELI, Spain — Millions of people crowded cloudless cities and towns in Spain on Wednesday in search of the best views of a total solar eclipse, when the alignment of the sun, moon and Earth briefly plunged parts of the planet into darkness.

The crowds brought lawn chairs and umbrellas as they eagerly awaited the celestial spectacle, which began early in the evening. As the sky darkened, gradually at first and then quickly, people broke into applause and cheered. It was the country’s first total solar eclipse in more than a century.