Around madrid we were cleared told to climb to a flight level and given a heading that set us up for a near miss ( head on ) with a heavy jet , we could see the Iberia pilot wipe the sweat of his brow as we took evasive action. This is the second time i personally have experienced this once we were VFR but the last IFR.