Abstract The thermodynamic stability of the b.c.c.- and f.c.c.-based ordered phases of NiTi and NiAl has been studied with a highly accurate first-principles electronic structure method. The occurrence of a martensitic transformation in NiAl B2 ordered intermetallic alloys will be discussed and related to the existence of intermediate structures between b.c.c.- and f.c.c.-based phases. It will be shown that closely related ordered structures can exist on f.c.c. and b.c.c. lattices in the composition range where the transformation occurs. A variety of antiphase boundaries in the B2 and L12 structures will be examined and the pertinent energies will be compared with experimental data. In addition, the rather unusual appearance of the NiTi B2 ordered structure in the phase diagram will be discussed.