The site preference, electronic structure, magnetic properties and martensitic transformation in Heusler alloys Ni2CoZ (Z = Al, Ga, In, Si, Ge, Sn, Sb) have been investigated by first-principles calculations. Different from literature, it is found that these Ni2CoZ alloys tend to form XA structure (Hg2CuTi-type), except for Ni2CoIn, in which L21 (Cu2MnAl-type) structure is preferable. Theoretical calculation reveals that the tetragonal martensitic phase has a lower total energy compared with the cubic austenitic phase, therefore, a structural transition from cubic to tetragonal is likely to happen in these Ni2CoZ alloys. The largest energy difference is observed in Ni2CoIn. It is interesting that Ni2CoSi is paramagnetic in austenitic state, while is ferromagnetic in martensitic state. This leads to a large change in the total moment, which is meaningful for the realization of magnetic field-induced martensitic transformation in this alloy.