The palladium-catalysed four-component coupling of a halide, terminal alkyne, molybdenum hexacarbonyl and either a hydrazine or amidine has been shown to be an efficient method for the construction of highly substituted pyrazoles and pyrimidines, respectively, in a one-pot process.