  We present a high precision lattice calculation of the average up/down,
strange and charm quark masses performed with Nf=2 twisted mass Wilson
fermions. The analysis includes data at four values of the lattice spacing and
pion masses as low as ~270 MeV, allowing for accurate continuum limit and
chiral extrapolation. The strange and charm masses are extracted by using
several methods, based on different observables: the kaon and the eta_s meson
for the strange quark and the D, D_s and eta_c mesons for the charm. The quark
mass renormalization is carried out non-perturbatively using the RI-MOM method.
The results for the quark masses in the MSbar scheme read: m_ud(2 GeV)= 3.6(2)
MeV, m_s(2 GeV)=95(6) MeV and m_c(m_c)=1.28(4) GeV. We also obtain the ratios
m_s/m_ud=27.3(9) and m_c/m_s=12.0(3).
