Cole Hamels struggles, provides just enough in win