Use a Spirit Level
As DIY expert John D. Wagner points out, a spirit level is a very useful device that allows you to check that things are level (horizontal) or plumb (vertical). Hold a spirit level against the side of a deck post when fixing to ensure that is is plumb. It will then be aligned to any other deck posts you fix in at least one way.
Accurate Measurement
The trusty old tape measure is still in use today, although it may gradually be replaced by the laser tape measure with digital display. Either way, accurate measuring is another way to ensure deck posts are aligned properly. Measure from a fixed point, such as the house wall, to the base and top of a fixed post. Now transfer the measurements to the post that is about to be fixed.
Use String
As professional carpenter and deck builder Scott Schuttner points out, string can be used to help align deck posts. Hammer sharpened marker sticks into the ground on the line of the intended deck post run. Tie string between them to act as a physical indicator of where each post should go. Don't rely solely on the string as it may move with a breeze. Always confirm post positions with a tape measure and spirit level.