invented in 1705 by Thomas Newcomen
"The ENGINE for raising water (with a power made) by FIRE."
A 1711 illustration of Newcomen's steam engine for pumping water from mines.
Newcomen's engine was an improvement on a similar design patented in 1698 by Thomas Savery. Newcomen and Savery went into partnership and built the first working steam engine in 1712.
The diagram below illustrates the principle: Water is heated in the boiler to produce steam. The steam enters the cylinder. The steam pressure is insufficient to raise the piston; most of the work is done by the weight, which pulls the cross-beam down and the piston up.
When the piston is at its heighest point cold water is introduced into the cylinder at the cold water inlet cwi, causing condensation of the steam. The resulting contraction produces a vacuum effect, and the outside pressure from the atmosphere pushes the piston down, causing the engine to raise the water from the mine shaft.
In a separate window you can see the Newcomen steam engine in operation as an animation.