The reading was the fifth month in a row that prices have risen above the central bank's target for price stability.
Prices rose 0.5% versus May as fuel, heating oil and vegetables became more expensive. Prices for red wines and salads decreased.
Swiss prices had increased in May by their highest level in nearly 14 years. The consumer price index rose by 2.9% compared with a year earlier as transport, food and drinks became much more expensive in a country noted for its historically low inflation.
Ongoing inflationary pressure means further monetary policy tightening will likely be needed, Swiss National Bank Chairman Thomas Jordan said last month after the central bank raised its interest rate for the first time in 15 years.
"We published a new inflation forecast. If you interpret it correctly, you see that there's a certain need probably to tighten further," Jordan told a conference in Zurich.
(Reporting by Michael Shields and John Revill; editing by Matthias Williams)