Some foods — vegetables, nuts, fruits, and whole grains — were associated with less weight gain when consumption was actually increased. Obviously, such foods provide calories and cannot violate thermodynamic laws. Their inverse associations with weight gain suggest that the increase in their consumption reduced the intake of other foods to a greater (caloric) extent, decreasing the overall amount of energy consumed.
Their view isn't that counting calories doesn't work because the science is wrong, but because you're less inclined to follow through due to satiety issues associated with foods. To put it another way, you can't have a bag of chips, and counterbalance it by having a yogurt before going to bed.
To me this reporting is sloppy.
A much more accurate headline would be, "Eating the right foods will help you stick to your calorie counting diet".