The process of alignment, a new fundamental interaction between vortices in a stratified and rapidly rotating fluid, is defined and studied in detail in the context of the two-layer quasi-geostrophic model. Alignment occurs when two vortices in different density layers coalesce by reducing their horizontal separation. It is found that only vortices whose radii are comparable with or larger than the Rossby deformation radius can align. In the same way as the merger process (in a single two-dimensional layer) is related to the reverse energy cascade of two-dimensional turbulence, geostrophic potential vorticity alignment is related the barotropic-to-baroclinic energy cascade of geostrophic turbulence in two layers. It is also shown how alignment is intimately connected with the existence of two-layer doubly connected geostrophic potential vorticity equilibria (V-states), for which the analysis of the geometry of the stream function in the corotating frame is found to be a crucial diagnostic. The finite-area analogues of the hetons of Hogg & Stommel (1985) are also determined: they consist of a propagating pair of opposite-signed potential vorticity patches located in different layers.