Yes, particularly if you are new to training, returning after a break, or carrying higher body fat. It requires adequate protein, progressive resistance training, and only a small calorie deficit. Progress in both directions is slower than focusing on one at a time.
Lean, well-trained people generally find it very difficult. Their potential for new muscle is small, and their stored energy is limited, so a deficit tends to mean maintaining muscle at best. That is a perfectly good outcome, but it is not simultaneous gain.
The scale is a poor instrument for this, because gaining muscle and losing fat can leave bodyweight almost unchanged for months. Use waist and limb measurements, four-weekly photographs, and gym performance instead. Strength going up while the waist goes down is the signal you are looking for.
If nothing has changed in either direction after three months of consistent effort, pick a direction. A focused three-month building phase followed by a focused fat-loss phase will usually get you further than a year of trying to do both at once.
The training requirements are set out in Hypertrophy and Muscle Growth.