BOSTON — The Massachusetts unemployment rate climbed to 7 percent in June, the first time in more than a year-and-a-half it has gone that high, but preliminary federal estimates also showed the state continued to gain jobs, the office of Labor and Workforce Development said Thursday.

The June jobless rate rose from 6.6 percent in May. It has averaged 6.7 percent over the past 12 months, officials said.