Northern Vietnam has a cool to cold season (courtesy of the northeast monsoon from November to March) and a warm to hot wet season (from April to October). December and January in particular can get quite frosty in the far north of Vietnam -- pack accordingly. This time of the year can also see heavy mists that can run for days -- these can reduce visibility in places like Sapa and Ha Long Bay to frustratingly short distances. The wettest months of the year in Hanoi are July and August, the driest, December and January.
Central Vietnam is kind of a transitionary area climate-wise from the north to the south. As the coast line is shielded by the Truong Son mountain range the rains that come with the southwest monsoon don't make it to the coast, so between April and September, while the coastal area does see some rain, it does see less than other parts of the country.
This advantage is reversed though come the northeast monsoon when, between September and December, the northern section of Central Vietnam (Hoi An and Da Nang through to Hue and Dong Ha) receive considerable rain. This region can also be affected by typhoon season in the Western Pacific, which can see severe storms lashing the coast from August to November -- Hoi An in particular often floods in October or November. Further south though, the southern coastal strip from around Nha Trang to Mui Ne is less affected by the rain and sees a longer dry and sunny season.
Without the protection of the Truong Son mountain range, southern Vietnam, especially the Mekong Delta, gets plenty of rain and hot, humid weather during the southwest monsoon from April to September, with June and July being especially wet. At this time you'll most likely see some flooding in Saigon and the southern island of Phu Quoc can see persistently poor weather and rough seas.
There is no perfect time to visit Vietnam. Generally speaking, destinations in the north such as Hanoi and Sapa are great in October, November and December, as you'll see little rain and should have clear skies and temperate conditions.
The coastal stretch from Hue down to Nha Trang is great in the first half of the year, from January through to July, while Saigon and the Mekong Delta are best from November through to February or March.