Here are a couple of ways to do this, starting with the common quick way:
Quickly align to Global X, Y, or Z
1. Select the verts you want to align.
If they are all on the same edge you can select the edge loop from the Select menu.
2. Scale on the axis you want to align them all to, and type "0".
3. Type in a location value for that axis.
I find aligning to 0 first and then positioning to be sufficient for most cases. However there are times when you'll want to use the 3D cursor instead of aligning first and then positioning. There are also cases where you may want to use a custom axis (transform orientation). The following method describes how to do that.
Align to a custom Transform Orientation
1. In Vertex Select Mode, draw an edge
You can use Ctrl+LeftClick to create and then extrude vertices.
Then with the entire edge selected, snap the Cursor to Selection using ShiftS
2. Create a custom Transform Orientation from the edge
With the edge still selected, click the "+" button in the Properties Shelf under the Transform Orientations panel.
3. Select it for use
Click the Transform Orientation button which is by default set to "Global" and choose "Edge".
4. Scale along it
You can now hide (H) or delete (X) your guide edge.
Select the vertices you want to align.
Set your Pivot Point to "3D Cursor".
Scale (S) and constrain to your custom Transform Orientation by double-tapping an axis key (XX, YY, or ZZ). Then type "0".