SAN FRANCISCO – Like any other first-time participant, Chicago Cubs second baseman Javier Baez was elated to be chosen for the All-Star Game, and as a starter no less.

Major League Baseball should be just as thrilled that the fans got it right. The game could use lots more like him.

At a time when MLB is struggling to attract a younger audience, address its pace-of-play issues and retain its fan base – overall attendance is down more than 6 percent from last season at this time – Baez steps into the midsummer showcase as one of the possible antidotes for the game’s troubling lack of action.

Baez, 25, routinely takes monstrous hacks better suited for the Home Run Derby, in which he’ll also compete. He plays three infield positions with a flair not seen since Hall of Famer Roberto Alomar was collecting 10 Gold Gloves. He’s a daredevil on the bases, twice stealing home this season. And he has turned the seemingly mundane task of tagging into nearly an art form.

“He’s the most exciting player in the game right now, and he’s also getting better,’’ said Cubs manager Joe Maddon, obviously a biased observer, but one whose opinion is shared by others.

San Francisco Giants shortstop Brandon Crawford, who will start for the National League as Baez’s keystone partner, twice used the term “exciting player’’ in assessing his game.

“There are a lot of times when he can win you a game on the bases or in the field just from athleticism,’’ Crawford said. “That’s part of what makes him so dynamic.’’

But much of what makes Baez such a treat to watch – the risky baserunning, defensive élan and mighty swings at any pitch in his periphery – also runs counter to the game’s strong leaning toward analytics.

He doesn’t work counts or draw walks, earning fewer per plate appearance than any player in the NL. He steals bases – a career-high 17 this season, getting caught only once – a practice often eschewed by sabermetrics proponents.

And the notion of waiting for a good pitch to hit? Baez swings at more pitches outside the strike zone than any player in the league, 48.3% of them according to FanGraphs, although Maddon points out he’s getting better at picking his spots.

Indeed, Baez has cut down his strikeout percentage from an appalling 41.5 as a rookie in 2014 to 24.6 this season, more in line with the major league rate of 22.3.

Moreover, fans can’t get enough of him, often breaking into chants of “Ja-vy! Ja-vy’’ even at road ballparks when Baez turns in another awe-inspiring play, which has been frequently this season. He’s batting .289 with 18 home runs and 66 RBI, tied for third in the NL, and he’s only the fourth major leaguer in the last 10 seasons to compile at least 17 home runs and 17 steals before the All-Star break.

Plus, Baez may lead the league in the unmeasurable category of having fun, which he believes is becoming scarcer in baseball, partly because of a preoccupation with statistics.

“A lot of people forget that before a business, this is a game,’’ Baez told USA TODAY Sports. “Some people are getting caught up in the noise from outside and what may be talked about from the (front) office. Baseball is too difficult to have all those things in your head. … If you go to the plate with all this information that says you can’t hit this guy, you’ve already struck out.’’

Baez, who was born in Puerto Rico and moved stateside when he was 12, makes the comments in Spanish while wearing Crocs adorned by the words El Mago, the magician. The nickname emerged during the 2017 World Baseball Classic as a group of Puerto Rican fans, amazed by his sleight of hand on the field, tossed the term around on Twitter. Baez liked it, retweeted it and watched it stick.

The moniker is perfectly suited for his flashy style of play, which can sometimes irk opponents and scouts, who’d prefer he focus on making the routine play than the spectacular one. That’s also been a point of emphasis for Maddon, who has seen Baez grow into a more polished fielder. Starting 53 games at second, 18 at shortstop and seven at third, Baez has committed a total of 10 errors.

He insists the snazzy aspects of his game are not by design, and off the field he comes across as low-key.

“I honestly don’t look at is as a style. That’s just how I play. All I do is to try to help my team. I know sometimes it looks flashy, but I’m not trying to be disrespectful,’’ said Baez, adding that criticism makes up a small percentage of the feedback he gets.

“It doesn’t bother me,’’ he said, “because nobody’s a $100 bill, as we say. Not everybody’s going to like you.’’

Maddon says he’s mindful not to curtail Baez’s superb instincts or athleticism by imposing too many restrictions on him. That’s an approach endorsed by Giants manager Bruce Bochy, who won three World Series with a free-swinging third baseman in Pablo Sandoval, now back with the club.

Bochy cites Hall of Famers Yogi Berra and Vladimir Guerrero as examples of hitters who regularly chased pitches outside the zone, but were successful because of their extraordinary contact skills.

“You have to let them be who they are, and they’re going to get better with experience,’’ Bochy said. “Baez was a guy who did a lot of chasing. I’m sure it frustrated them. But now it’s getting a little more under control and consequently he’s having a big year.’’

However, Bochy acknowledges that extending some leeway to those kind of players is more difficult at a time when many front-office decisions are based on metrics, rather than the eye test. Players who can consistently draw walks are a safer bet than those who routinely expand the strike zone.

Then again, the latter are also more fun to watch. Giants fans always get a kick out of seeing Sandoval rip a pitch around his eyes for a hit.

Maddon advocates the value of analytics, primarily in player acquisition, but says they’re more applicable to defensive positioning and pitching than hitting. He also sees the pendulum swinging back toward talent and athleticism.

“I think the analytical component is going to take a back seat to the baseball player. I think we’re coming back to that direction,’’ Maddon said. “I want a good baseball player. I want a guy who’s young like Javy, who has his heart and his ability to see things and his instincts on the field, and then we’ll work with all this other stuff to make him better in these other areas. He can be this analytically great player, but if he doesn’t have the instincts and the heart to play the game like he does, he’ll never be Javy Baez.’’