The fireworks usually start around 10 PM and the ships sail before that as a rule. Also the fireworks are on the Charles river not the harbor but you might be able to see them if you are still in port.
Will we see the fireworks from the ship (Explorer of the Seas)?
We will be sailing in a year but we're excited about the idea of seeing Boston's show!
I really doubt that you will see the fireworks from the ship. The Massachusetts Port Authority's Black Falcoln Cruise Terminal, where all cruise ships calling in Boston dock, is in South Boston, on the southeast side of downtown, while the Esplanade, where people gather view the city's fireworks, is on the northwest side of downtown. The skyscrapers downtown will pretty much block whatever view you might have from the ship. Of course, this point probably is moot because most ships do leave port well before the start of the fireworks display at 10:00.
If the ship remains in port late that evening, though, it probably will offer a shore excursion to the concert at the Hatch Shell on the Esplanade by the Boston Pops Esplanade Orchestra and the fireworks display. The concert actually continues through the fireworks display.