Detection of very high energy gamma-ray emission from the gravitationally lensed blazar QSO B0218+357 with the MAGIC telescopes