By Jonathan Spicer

CAMBRIDGE, Mass. (Reuters) - The Federal Reserve could raise interest rates up to two times before year end, a top Fed official said on Friday as he downplayed data that showed the U.S. economy grew far less than expected in the last quarter.

San Francisco Fed President John Williams said the second-quarter gross domestic product reading was weak because of swings in inventories and government spending, noting that some underlying data in the report "look good."

Williams, an influential centrist at the U.S. central bank, spoke just hours after the Commerce Department said GDP growth was 1.2 percent last quarter and only 0.8 percent in the previous quarter.

That compares to the Fed's expectation of about 2 percent growth for 2016, and may entrench the view among some investors that the central bank will not raise rates any time soon, despite a relatively upbeat statement from Fed policymakers earlier this week.

But Williams, who does not have a vote on policy at the Fed's remaining three meetings this year, noted there are two key employment and inflation reports before the next meeting in mid-September. "It makes sense, assuming the data continue to support that, to raise rates again this year," he said.

"There is definitely a data stream that could come through in the next couple of months that I would think would be supportive of two rate increases," Williams told reporters after addressing a group of pension investors. "There's data we could get that wouldn't be supportive of that and it could be supportive of one maybe, or of none."

The strong June employment report combined with the weak economic growth suggests U.S. productivity, which is key to boosting GDP from years of malaise, is even weaker than already assumed, he said.

But, he said of the GDP report, "when I look at the underlying data like final sales... they look good. There are always ups and downs to government spending and inventories but this time it was particularly negative both in Q1 and Q2."

On Wednesday the Fed's policy-making Federal Open Market Committee said near-term risks to the U.S. economy have diminished.

Williams, the first Fed official to publicly speak since then, said that statement referred to positive recent data on job growth and consumer spending that suggested the overall U.S. expansion is not about to stall. It also reflected the fact that Britain's vote last month to leave the European Union "seems like it will not have a big effect on the (U.S.) outlook," he said.

(Reporting by Jonathan Spicer; Editing by Meredith Mazzilli)