This is something that cannot be done online. You will need to visit a Driver Service Center and present your legal document showing how your name has changed.
Example: You will need to bring your certified marriage certificate, or your divorce decree signed by the judge.
To avoid an extended wait time, making an appointment is highly recommended.