Does a x4 PCIe mechanical work in a x16 slot in x4 mode?

Yes. The x16 slot is physically bigger than the x4 card and has 4 PCIe lanes available, so the x4 card will fit, and run at full speed.