The structural stability and mechanical properties of Co3(Al, M) (M = Ti, V, Cr, Zr, Nb, Mo, Hf, Ta, W) compounds with cubic L12-type and hexagonal D019-type structures have been investigated by first-principles calculations. Calculated temperature-dependent formation energies indicate that all the L12-type Co3(Al, M) can be generated at high temperature and show better stability than their D019-type according to the quasi-harmonic Debye model. Furthermore, we reveal that the element Al plays a major role in promoting L12 structure more stable than D019 structure for the Co3(Al, W), and the element W reduces metastability as well as improves the strength of L12. We also find that most of the L12-Co3(Al, M) compounds possess good mechanical stability and ductility, which are verified by the elastic constants and Poisson’s ratio. More importantly, the element Cr can be used to replace the W of L12-Co3(Al, W) to increase the strength to weight ratio as the L12-Co3(Al, Cr) possesses comparable elastic properties to the L12-Co3(Al, W), including the Young’s and shear moduli. It is also observed that all the L12-Co3(Al, M) compounds show a high degree of elastic anisotropy. The electron localized function and suggests that the rise of the Young’s moduli in Co3(Al, M), with the alloying element M changing from group IVB to VIB, is mainly attributed by the increasing bonding strength of the nearby transition-metal atoms. Our results will be useful for the study of thermodynamic and mechanical properties as well as the design of Co-based high-temperature alloys.