State police say the shootings happened this morning in the town of Madison.
State police spokesman Steve McCausland says the gunman was then fatally shot by Somerset County deputies.
In addition to the three dead, a fourth person was wounded.
No further details were available.
The attorney general's office sent investigators to the scene to review the use of deadly force by sheriff's deputies.