tfb's answer correctly describes the working cycle - just wanted to capture some of the extra questions in the comments.
Ideally you want to fill the cylinder with steam to lift it and then have the steam disappear creating a vacuum to pull the cylinder down. In Newcomen's original engine this was done by spraying cold water into the cylinder, cooling the steam and creating a partial vacuum - air pressure on the top of the cylinder than pushes it down. (Incidentally this was the power stroke because they wanted the other end of the beam to go up to lift water out of the mine.)
The problem with this is that you cool the cylinder walls on each cycle, so the fresh hot steam for the next stroke immediately starts to condense on the cold walls and it isn't until the walls have heated above boiling point that any steam can start to lift the cylinder.
Watt's breakthrough was the idea that since steam is a fluid you can remove it from the cylinder by connecting it to a separate vacuum. After the steam has filled the second tank (the condensor) you close the valve and spray cold water into the condensor, condensing the steam and creating the vacuum ready for the next stroke. (You also have to occasionally pump out the water from the condensed steam.)
By doing this you keep the cylinder hot and the condensor cold so you don't waste energy and ultimately fuel.