TOKYO—An explosion that struck the controversial Yasukuni Shrine in Tokyo on Monday may have been a politically motivated attack, police said.

No one was injured in the blast, which hit at 10 a.m. local time ahead of a ceremony to celebrate the autumn harvest, on a national holiday in Japan.

At the time of the incident, about 20 Shinto priests...