An efficient chemoselective synthesis of novel substituted pyrano [2,3-d]pyrimidines is described. A number of pyrano[2,3-d:6,5-d']dipyrimidine-2,4,6,8(3H,5H,7H,9H)-tetraones and their sulfur analogs were synthesized through a one-pot condensation of arylglyoxal monohydrates with barbituric acid and thiobarbituric acid in the presence of excess ammonium acetate in water at room temperature, affording the desired products in moderate to good yields.