I was hired as a Software Architect at one company and after about a year and a half on the job we were without a CTO and nobody over my direct manager, who essentially managed the team internally (very well) but wasn't the public persona that I was within the company. Being an agency we needed a lot of internal self promotion as a team, as well as making our sales team aware of what we were capable of and doing that they may not know, as well as being part of pitches that were more technical than average.
I drafted a new role that formalized all those things I had been doing and some, suggested a meager salary bump (like 5-7% when year over year bumps were between 3-5). My manager was on board, but getting leadership buy in besides "that's a great idea" languished for months.
I finally got an offer from a different company that offered all that and more, at a large salary bump (over 25%), large bonuses, options, and a number of other perks just not available to my privately held 200 person company. The huge problem with the new role was at least 30% travel (which means more like 60) and I had a baby and a baby on the way. I offered my resignation and they begged for 24 hours to put together a counter.
Their counter was a blanket okay of my plan, with a twist. I went from Architect to Director and became my boss' boss. They couldn't quite match the salary "because that would make me the highest paid employee at the company" but offered some creative ways to make bonuses to cover the gap.
I always preached the 'never accept a counter' theory, but I'd liked working at this company more than anywhere else and the thought of traveling that much (I used to travel a lot before) was awful sounding. I accepted and was gone 16 months later- so I made it! Honestly though, as much as I loved the work and the creativity we didn't have the time to really get deep into interesting tech. If we did, it was skunkworks projects (I started the skunkworks lab with beer and pizza) that meant working before and after hours and weekends to ever get a concept done.
I didn't leave for just any other company though, I went and started my own. I'm glad I accepted that counter, I never would've had the chance to take my current leap if I had left for the other company.
I've semi-changed my stance now. If you trust your team and leadership, and trust that you are going to be given the power to affect the changes you were looking for that had you looking to leave- then accept the counter. If it's the same ol' same ol' but you have a higher salary, you will wind up leaving sooner rather than later.