In answering this question, we should look at both the short-term and the long-term consequences of this attack.
In the short term, the attack on Pearl Harbor crippled the American fleet in the Pacific. The attack, combined with the attacks in the Philippines, made it impossible for the Americans to stop the spread of Japanese power early in the war. In the short term, then, the attack was a great success for Japan.
In the long term, the impact of the attack was much worse for Japan. The attack aroused the United States and made sure that it would be extremely angry at Japan. The attack instilled in Americans a strong desire for revenge. This ended up being very bad for Japan. The US was, of course, a much bigger and stronger country than Japan and its entry into the war (and its strong motivation to defeat Japan) doomed Japan. By drawing the US into the war and motivating it to utterly defeat Japan if possible, the attack on Pearl Harbor had very negative consequences for Japan.