There is some amount of controversy about whether the US knew about the impending attack on Pearl Harbor. Mainstream scholars believe that American leaders knew that the Japanese were likely to do something, but they had no idea when or where that something would happen. In that sense, an attack of some sort was not a surprise, but the specific attack on Pearl Harbor was a surprise.
So far as we know, the Japanese never transmitted a message to anyone saying that they were going to attack Pearl Harbor on December 7, 1941. There had been rumors almost a year before of such an attack, but there are typically many rumors flying around in times of crisis. The Americans knew that something was likely to happen and so all military units in the Pacific were sent an explicit warning in November of 1941 that war with Japan was likely. In that sense, the attack was clearly not a surprise. However, there is a big gulf between knowing that war was likely to break out somewhere in the Pacific at some time and knowing that the Japanese were going to attack Pearl Harbor in the near future. For this reason, I would say that the attack on Pearl Harbor was a surprise, even if the fact of a Japanese attack somewhere in the Pacific was not.