The 21-year-old joined Arsenal from Brazilian side Ituano in the summer of 2019 and has so far made 111 appearances for the Gunners.
Martinelli has scored seven goals in 27 appearances for Mikel Arteta's side this season, with Arsenal enjoying a five point lead at the top of the Premier League table.
Sporting Director Edu said: “It’s great that Gabi has signed a new contract with us. The foundations of our squad continue to be built on young talent, so it’s great that Gabi has signed a new contract.
"Gabi is still just 21, and a player with big ability and personality. He is an important part of our future and we’re delighted that we have agreed a new contract.”
Arteta added: “We’re delighted Gabi has signed a new long-term contract. Our supporters see his quality and energy every single time he puts on the shirt and he’s the same every day in training, with his hard work and positive values.
"Gabi is still very young, so we know there’s still much more to come from him and it’s great that we’ll be on this journey together. We’re now excited to continue to develop his huge talent and look forward to seeing him perform with Arsenal in the years to come.”
Martinelli has won six caps for the Brazil national team and was part of their World Cup squad in Qatar.