How Do Spacesuits Keep Astronauts Safe From the Vacuum of Space?

There were many iterations of the spacesuit before astronauts started wearing what they do today, but how do they work?

Read More:

Space Educator's Handbook: The Spacesuit (NASA)
"Earth's atmosphere is 20 percent oxygen and 80 percent nitrogen from sea level to about 75 miles up, where space begins. At 18,000 feet, the atmosphere is half as dense as it is on the ground, and at altitudes above 40/000 feet, air is so thin and the amount of oxygen so small that pressure oxygen masks no longer do the job. Above the 63,000-foot threshold, humans must wear spacesuits that supply oxygen for breathing and that maintain a pressure around the body to keep body fluids in the liquid state. At this altitude the total air pressure is no longer sufficient to keep body fluids from boiling."

Apollo Lunar Suit (Smithsonian's National Air And Space Museum)
"This space suit was worn on the Moon by an Apollo 15 astronaut in 1971. Moon dust is still visible on the legs and boots.The space suits had to meet all the astronauts' life-support needs. Backpacks (left on the Moon) provided oxygen, temperature and humidity control, suit pressure, and power for their communications and data display systems. This suit, made of 22 layers of several different materials plus a 3-layer undergarment, also protected them against extreme lunar temperatures and micrometeoroids."