US and Iranian officials have held face-to-face talks in Pakistan, the most significant diplomatic engagement since 1979.