The Senate vote was 31-19, with 18 Republicans and 13 Democrats voting in support. The bill now moves to the state House, which is expected to take it up later tonight.
If enacted, Pennsylvania will - in a significant change from the gaming world it set up 13 years ago - for the first time sanction commercial gambling outside 12 original licensed casinos and racetracks.
The new casinos could be in secondary, but potentially attractive, markets like State College, Gettysburg and the Lake Erie waterfront. And the Internet games will turn virtually any online device into a betting position.
The bill was the result of a temporary truce in an intense battle over the introduction of VGTs, the slots-style games that many House members had hoped to make available to bars, restaurants and private clubs.
The Senate, which has fewer supporters of VGTs, moved from a no-VGT position that it had struck through most of the summer and fall to allowing the games at truck stops only in an attempt to meet the House halfway.