We present a lattice calculation of the Hadronic Vacuum Polarization (HVP) contribution of the strange and charm quarks to the anomalous magnetic moment of the muon including leading-order electromagnetic corrections. We employ the gauge configurations generated by the European Twisted Mass Collaboration (ETMC) with Nf=2+1+1 dynamical quarks at three values of the lattice spacing (a≃0.062,0.082,0.089 fm) with pion masses in the range Mπ≃210−450 MeV. The strange and charm quark masses are tuned at their physical values. Neglecting disconnected diagrams and after the extrapolations to the physical pion mass and to the continuum limit we obtain: aμs(αem2)=(53.1±2.5)⋅10−10, aμs(αem3)=(−0.018±0.011)⋅10−10 and aμc(αem2)=(14.75±0.56)⋅10−10, aμc(αem3)=(−0.030±0.013)⋅10−10 for the strange and charm contributions, respectively.