Any place on any musical instrument you can find to play the notes G, B & D together you are playing a G major chord. With that in mind, this voicing is a G chord.
|--------------------------------------------|
|--------------------------------------------|
|--------------------------------------------|
|---0----------------------------------------|
|---2----------------------------------------|
|---3----------------------------------------|
Because you are playing those 3 notes.
||---|---|---|---|---|---|---|---|---|
||---|---|---|---|---|---|---|---|---|
||---|---|---|---|---|---|---|---|---|
D ||---|---|---|---|---|---|---|---|---|
||---|-B-|---|---|---|---|---|---|---|
||---|---|-G-|---|---|---|---|---|---|
And if you add the other, higher pitched notes you are simply doubling some of those notes in a higher register.
|---3----------------------------------------|
|---0----------------------------------------|
|---0----------------------------------------|
|---0----------------------------------------|
|---2----------------------------------------|
|---3----------------------------------------|
Just more of the same musical letters, but up an octave or 2!
||---|---|-G-|---|---|---|---|---|---|
B ||---|---|---|---|---|---|---|---|---|
G ||---|---|---|---|---|---|---|---|---|
D ||---|---|---|---|---|---|---|---|---|
||---|-B-|---|---|---|---|---|---|---|
||---|---|-G-|---|---|---|---|---|---|
And if you play the D on the B string, it's still a G major chord, because of that low B on the A string.
|---3----------------------------------------|
|---3----------------------------------------|
|---0----------------------------------------|
|---0----------------------------------------|
|---2----------------------------------------|
|---3----------------------------------------|
Just more of the same musical letters, but up an octave or 2!
||---|---|-G-|---|---|---|---|---|---|
||---|---|-D-|---|---|---|---|---|---|
G ||---|---|---|---|---|---|---|---|---|
D ||---|---|---|---|---|---|---|---|---|
||---|-B-|---|---|---|---|---|---|---|
||---|---|-G-|---|---|---|---|---|---|
Some rock players leave that low B out intentionally because once you start adding some gain & a lot of volume it gets really muddy. So they just mute the A string. And the result is a G5 chord, because there's no major 3rd, the note B.
|---3----------------------------------------|
|---3----------------------------------------|
|---0----------------------------------------|
|---0----------------------------------------|
|---X----------------------------------------|
|---3----------------------------------------|
Mute the A string with the pad of your middle finger as it leans over to grab the low G!
||---|---|-G-|---|---|---|---|---|---|
||---|---|-D-|---|---|---|---|---|---|
G ||---|---|---|---|---|---|---|---|---|
D ||---|---|---|---|---|---|---|---|---|
||---|-X-|---|---|---|---|---|---|---|
||---|---|-G-|---|---|---|---|---|---|
To get even more interesting, if you play a barre chord G major you use some of the same notes, but you play them in different places on the fretboard & get a somewhat different voicing.
|---3----------------------------------------|
|---3----------------------------------------|
|---4----------------------------------------|
|---5----------------------------------------|
|---5----------------------------------------|
|---3----------------------------------------|
Just more of the same musical letters, but up an octave or 2!
||---|---|-G-|---|---|---|---|---|---|
||---|---|-D-|---|---|---|---|---|---|
||---|---|---|-B-|---|---|---|---|---|
||---|---|---|---|-G-|---|---|---|---|
||---|---|---|---|-D-|---|---|---|---|
||---|---|-G-|---|---|---|---|---|---|
Hope this helps!