A wide aperture allows more light to reach the sensor, which makes the camera that much better at shooting in low light. LG went from f/2.4 on the G3 to f/1.8 on the G4, which translates to roughly 80% more light reaching the sensor. Samsung went from f/2.2 on the S5 to f/1.9 on the Galaxy S6, which gets 34% more light. The G4 and S6 however are pretty equal in this respect.
Then it's down to the sensor (helped by optical stabilization) to make the best of the available light. Some software too - LG has an automatic night mode (that you can't control in any way) that greatly reduces the noise. It makes capturing images quite slow though and it won't work for moving subjects.
Speaking of speed, the Galaxy S6 snaps photos faster since the G4 occasionally gets slowed down by the night mode. Our LG G4 unit also missed the focus on a few shots.
Both phones drop down the speed to a sluggish 1/10s, but the Galaxy S6 typically uses lower ISO to keep the noise down. In the first scene it shot at an optimistic ISO 200, while the LG G4 went up to ISO 500. The upper left shot is one where night mode triggered and ISO wasn't recorded, but the noise is visibly down without taking away from the fine detail.
Even with all the noise, the LG G4 captured more detail. Night mode cleans out most of the noise and even manages to bring in some extra detail. The Galaxy S6 photo is quite dark, which hides some of the detail, but you can go into Pro mode and boost the exposure compensation.
There's no Night mode though, so you have to do this manually. We edited a copy of the photo, brightening the shadows, to make it easier to compare to the G4.
You can view the full resolution images for a closer look.
Winner: LG G4. We wish we had manual control over the night mode, but it does an excellent job. Even if it doesn't get activated automatically, the night time shots are better exposed and have more detail than the Galaxy S6 managed.
The Galaxy S6 proved the more reliable shooter of the two though, with no out-of-focus shots. A night mode control would have been helpful here too, as photos turn out too dark and you have to either use Pro mode or retouch them after the fact.